Skip to main content
Live Webinar with SANS (June 25)— Agentic CTI Automation for Fun & ProfitRegister Free
Mallory
HighPublic exploit

Unauthenticated command execution in OpenCode local HTTP server

IdentifiersCVE-2026-22812CWE-306· Missing Authentication for…

CVE-2026-22812 affects OpenCode, an open source AI coding agent. In versions prior to 1.0.216, OpenCode automatically starts a local HTTP server without authentication. The exposed backend includes sensitive endpoints such as POST /session/:id/shell, which can execute arbitrary shell commands, and GET /file/content?path=, which can read arbitrary files from disk. The server is also configured with permissive CORS, allowing requests from arbitrary origins, which means exploitation is not limited to local processes and can also be triggered by a malicious website in some browser contexts. Successful exploitation results in command execution with the privileges of the user running OpenCode. The issue is fixed in version 1.0.216.

Share:
For your environment

Are you exposed to this one?

Mallory correlates every CVE against your assets, your vendors, and active adversary campaigns. Know which vulnerabilities matter for you, not just which ones are loud.

ANALYST BRIEF

Impact, mitigation & remediation

What it means. What to do now. Patch path, mitigations, and the assume-compromise checklist.

Impact

What an attacker gets, and what they’ve been doing with it.

An attacker can achieve arbitrary command execution as the local user running OpenCode, resulting in full compromise of that user context. This includes the ability to run shell commands, access or modify user-accessible data, install persistence in the user profile, steal credentials or tokens available to that user, and pivot into developer tooling or source repositories. The exposed file-read functionality also enables arbitrary file disclosure. If OpenCode is started with --mdns and binds to 0.0.0.0, exposure may extend beyond localhost to the local network, increasing attack surface.

Mitigation

If you can’t patch tonight, do this now.

Until patching, avoid running OpenCode while visiting untrusted websites. Do not use the --mdns flag, as it can bind the service to 0.0.0.0 and advertise it on the local network. Restrict the service to localhost only and block inbound access to the OpenCode port range (default 4096+) with host firewall controls. If operationally possible, disable or stop the component that automatically starts the HTTP server. Treat any untrusted local code execution, including npm scripts, as high risk while OpenCode is running.

Remediation

Patch, then assume compromise.

Upgrade OpenCode (npm package opencode-ai) to version 1.0.216 or later, which fixes the vulnerability. If validating remediation, confirm that the automatically started HTTP server no longer exposes sensitive endpoints without authentication and that unsafe cross-origin access is no longer permitted.
PUBLIC EXPLOITS

Exploits

6 valid exploits after Mallory filtered fakes, detection scripts, and README-only repos (4 hidden).

VALID 6 / 10 TOTALView more in app
CVE-2026-22812MaturityPoCFrameworknucleiVerified exploit

Repository contains a Python exploit and a Nuclei template targeting CVE-2026-22812 in anomalyco OpenCode versions earlier than 1.0.216. The issue is an unauthenticated HTTP service that exposes command execution and related functionality. The Python script is the primary exploit implementation: it initializes a requests session, checks vulnerability by POSTing to /session, stores the returned session id, and then uses /session/{id}/shell with JSON payloads containing an attacker-controlled command. Based on the visible CLI handling and method names, it supports vulnerability checking, one-shot command execution, interactive shell access, system information gathering, file reading, file upload, and file download. It also supports configurable timeout and HTTP/HTTPS proxying. The YAML file is a Nuclei template that fingerprints the vulnerability by chaining requests to /session, /session/{{session_id}}/shell, /pty, and /file/content?path=/etc/hostname. It extracts the session id from JSON and confirms exploitation by matching the echoed marker string `CVE202622812VULN`, PTY behavior, file-read success, or session creation bypass. Because this repository includes a Nuclei template, it belongs to a framework; however, the repository also includes standalone exploit code. Overall purpose: provide both active exploitation and scanner-based validation for OpenCode's exposed local HTTP API leading to unauthenticated RCE and file access.

0xBlackashDisclosed Apr 6, 2026pythonyamlwebbrowserlocal
CVE-2026-22812-POCMaturityPoCFrameworknuclei (detection template present); standalone python exploit also includedVerified exploit

Repository contains a Nuclei detection template plus a standalone Python exploit for alleged OpenCode unauthenticated RCE (CVE-2026-22812). Structure: - CVE-2026-22812-detect.yaml: Nuclei template that probes BaseURL and common OpenCode ports (4096-4100) to (1) identify OpenCode via body keywords ("OpenCode"/"opencode-sdk") and (2) confirm unauthenticated session creation by POSTing to /session and matching HTTP 200/201 with a JSON body containing an "id". - rce.py: Main exploit tool. Implements an OpenCodeExploiter class using requests.Session with a distinctive User-Agent. Core flow is POST {url}/session to obtain a session id, then POST {url}/session/{id}/shell with JSON {agent:"build", command:<cmd>} to execute arbitrary commands. Includes a GET {url}/file/content?path=<path> helper to read file contents. The check routine validates the target looks like OpenCode, creates a session, and runs a benign command (echo 'VULN_TEST') to confirm RCE. The script also supports scanning multiple targets concurrently (ThreadPoolExecutor) and printing/saving results. - README.md: Usage examples (check, command execution, file read, list scanning) and notes default ports 4095-4100 and search dorks. Capabilities: - Unauthenticated remote command execution against exposed OpenCode HTTP API. - Unauthenticated file read via file content endpoint. - Target discovery/checking and multi-target scanning with concurrency and optional output. Notes: - The provided rce.py content is truncated in the supplied snapshot, but the visible portions clearly show the exploit primitives (/session, /session/{id}/shell, /file/content) and the vulnerability check logic.

CayberModsDisclosed Jan 20, 2026pythonyamlnetwork (unauthenticated HTTP API abuse leading to RCE and file read)
CVE-2026-22812MaturityPoCFrameworknuclei (template included)Verified exploit

Repository contains a Python exploitation tool and a Nuclei template for CVE-2026-22812 (OpenCode < 1.0.216). The core exploit logic (CVE-2026-22812.py) uses unauthenticated HTTP requests to OpenCode’s exposed service to (1) create a session via POST /session and (2) execute arbitrary OS commands via POST /session/{session_id}/shell with a JSON body containing an agent name and command. The README indicates additional capabilities implemented in the Python tool: interactive shell mode, file read/write, upload/download, and system reconnaissance, with optional HTTP proxy support and basic statistics tracking. Structure/purpose: - CVE-2026-22812.py: primary exploit client (requests-based), session creation, command execution, interactive loop, and file operations (per README and visible endpoint usage). - CVE-2026-22812.yaml: Nuclei template to detect/confirm the issue by creating a session, executing a benign echo command, optionally probing /pty, and reading /file/content?path=/etc/hostname. - README.md: usage examples and endpoint documentation. - LICENSE: MIT. Overall, this is an operational unauthenticated RCE exploit client for OpenCode’s exposed HTTP endpoints, plus a scanner template to validate vulnerability and basic exploitation primitives.

0xgh057r3c0nDisclosed Jan 19, 2026pythonyamlnetwork (unauthenticated HTTP RCE via exposed OpenCode endpoints)
Ashwesker-CVE-2026-22812MaturityPoCVerified exploit

Repository contains a standalone Python proof-of-concept/operational exploit for CVE-2026-22812 (OpenCode unauthenticated HTTP server leading to RCE). Structure: (1) CVE-2026-22812.py is the main exploit tool using requests.Session with TLS verification disabled and optional proxy support. It first creates an unauthenticated session via POST {target}/session and then achieves RCE by POSTing JSON to {target}/session/{id}/shell with fields including agent='build' and an attacker-supplied command. The script supports multiple operator workflows: vulnerability verification, single-command execution, and an interactive shell loop. The truncated portion plus README indicate additional helper features implemented in the script: reading files, uploading/writing files, downloading/exfiltrating files, collecting system information (hostname/user/kernel/os/processes), and creating a PTY session for improved interactivity. (2) README.md documents affected versions (<1.0.216), attack scenario (network reachable local server + permissive CORS enabling browser-assisted attacks), and provides usage examples for verify/command/interactive/file ops/sysinfo. (3) requirements.txt pins requests/urllib3. Overall purpose: provide unauthenticated remote command execution and post-exploitation convenience functions against vulnerable OpenCode instances exposed on an HTTP port (examples use :4096).

AshweskerDisclosed Jan 17, 2026pythonnetwork
CVE-2026-22812-ExpMaturityPoCVerified exploit

Repository contains a single Python exploit script (CVE-2026-22812.py) and a minimal README. The script is a network-based RCE PoC/operational exploit that takes a base URL from argv[1], strips a trailing slash, and uses the requests library (TLS verification disabled) to interact with a presumed vulnerable HTTP API. Workflow: 1) POST {BASE_URL}/session with browser-like headers to obtain/trigger a list of sessions. It checks for the substring 'ses_' in the response body and then parses the response as JSON. 2) Iterates over returned session objects, extracting sid['id']. 3) For each session id, POSTs to {BASE_URL}/session/{id}/shell with JSON payload {agent: 'build', command: 'touch /tmp/grass'}. 4) Prints the response; if HTTP 500, it tries the next session; otherwise it reports success and stops. Notable characteristics: hardcoded command payload (creates /tmp/grass), no authentication handling, no target fingerprinting beyond the 'ses_' substring check, and verify=False (susceptible to MITM but common in PoCs).

UdyzDisclosed Jan 16, 2026pythonnetwork
CVE-2026-22812-exploitMaturityPoCVerified exploit

Repository contains a standalone Python exploitation tool for CVE-2026-22812 (OpenCode unauthenticated RCE) targeting OpenCode versions < 1.0.216. Structure is minimal: (1) README.md documents features and usage, (2) exploit.py implements the exploit logic and CLI, (3) requirements.txt pins Python dependencies (requests, urllib3). Core exploit flow in exploit.py: - Establishes an HTTP client (requests.Session) with optional proxy support and TLS verification disabled. - Verifies vulnerability by attempting unauthenticated session creation via POST to the /session endpoint; on success it extracts a returned session id. - Performs RCE by POSTing JSON to /session/{session_id}/shell with fields like {"agent":"build","command":"<attacker command>"}. Capabilities advertised/implemented (per README and visible code portions): - Unauthenticated session creation (used as both a check and prerequisite). - Arbitrary command execution (single command mode and interactive shell mode with readline history). - File operations: read arbitrary files; upload/download files (implementation exists but is truncated in provided content). - System enumeration helper (e.g., hostname/user/kernel/os/ip/process listing) and optional PTY session creation. Primary network targets/endpoints are the OpenCode service base URL (commonly http://<host>:4096) and the REST-style paths /session and /session/{id}/shell. The tool is operational (usable end-to-end) and not merely a detector, as it provides interactive command execution and post-exploitation utilities.

rohmatariowDisclosed Jan 16, 2026pythonnetwork
EXPOSURE SURFACE

Affected products & vendors

Products and vendors Mallory has correlated with this vulnerability. Open in Mallory to drill down to specific CPE configurations and version ranges.

VendorProductType
AnomaOpencodeapplication
OpencodeOpencode-Aiapplication

Vendor-confirmed product mapping. Mallory continuously reconciles this list against your asset inventory.

What this page doesn’t show

The version that knows your environment.

This page is what’s public. Mallory adds the parts that aren’t: which of your assets are affected, which adversaries are exploiting it right now, which detections to deploy, and what to do tonight.
Exposure mapping

Query your assets running an affected version, and investigate the blast radius.

Threat actor evidence

Every observed campaign linking this CVE to a named adversary.

Associated malware

Malware families riding this exploit, with evidence and IOCs.

Detection signatures1

YARA, Sigma, Snort, and vendor rules, auto-deployed to your SIEM.

Vendor-by-vendor mapping

Cross-references every affected SKU, including bundled OEM variants.

Social activity14

Community discussion across Reddit, Mastodon, and other social sources.