CVE-2026–22812: How I Got RCE on a 71k-Star AI Coding Tool With Zero Authentication
OpenCode's local HTTP server on port 4096 had no authentication, allowing any local process or website to execute shell commands and read files as the user. An attacker could steal credentials, SSH keys, and source code, or establish a reverse shell.
OpenCode (71,000+ GitHub stars) automatically starts an HTTP server on port 4096 when you launch it. That server had zero authentication.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The HTTP server lacked any authentication mechanism, allowing unauthenticated access to critical functions.
Impact
An attacker could execute arbitrary commands, steal credentials and source code, and establish a reverse shell; the server also had a wildcard CORS header, allowing any website to make cross-origin requests.
What the attacker needed
OpenCode < 1.0.216 running; Attacker has local access or victim visits malicious site
The fix
The vulnerability was fixed in version 1.0.216 by adding an authentication token to the HTTP server.
How it was found
- Start the vulnerable OpenCode binary, which launches an HTTP server on port 4096.
- Create a session by sending a POST request to /session without credentials.
- Execute a shell command by sending a POST request to /session/{id}/shell with the command.
- Read arbitrary files by sending a GET request to /file/content with the file path.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
OpenCode is an AI coding assistant that runs a small web server on your computer to talk to its own parts. That server had no password or login check, so any other program on your machine, or even a website you visit, could send it commands. This let an attacker run any command as you and read your private files.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.