Description
Vulnerability Summary
The OpenCode codebase has critical security vulnerabilities:
- No CORS validation - /packages/opencode/src/server/server.ts:135 uses .use(cors()) with no origin restrictions
- No authentication - Any request works without tokens/credentials
- Arbitrary shell execution and file read - POST /session/:id/shell executes any command GET /file/content?path=/etc/passwd reads file by path
Attack Vector
Any website can:
- Scan localhost ports to find the OpenCode server
- List existing sessions via GET /session
- Create a new session via POST /session
- Execute arbitrary shell commands via POST /session/:id/shell
- Read any file via GET /file/content?path=/etc/passwd
OpenCode version
1.0.207
Steps to reproduce
- start opencode server (or just open opencode in any dir)
- go to https://mishkun.github.io/opencode-rce-poc/ and follow instructions
- enjoy being pwned
Screenshot and/or share link
No response
Operating System
macos
Terminal
iTerm2