ZAI-Shell — Unauthenticated Remote Code Execution via P2P Terminal Sharing (CVE-2026-25807)
by ibrahmsql · 2026-07-05
- Severity
- Critical
- CVE
- CVE-2026-25807
- Category
- network
- Affected product
- ZAI-Shell (P2P terminal-sharing tool)
- Affected versions
- Versions with P2P sharing running in --no-ai mode (per GHSA-6pjj-r955-34rr)
- Disclosed
- 2026-07-05
- Patch status
- unpatched
Tags
Archive entry
intelseclab/poc-archiveMetadata
| Field | Value |
|---|---|
| Date Added | 2026-07-05 |
| Last Updated | 2026-02 |
| Author / Researcher | ibrahmsql |
| CVE / Advisory | CVE-2026-25807 |
| Category | network |
| Severity | Critical |
| CVSS Score | Not specified in source |
| Status | PoC |
| Tags | zai-shell, p2p, rce, unauthenticated, terminal-sharing, socket, no-ai-mode, remote-command-execution |
| Related | N/A |
Affected Target
| Field | Value |
|---|---|
| Software / System | ZAI-Shell (P2P terminal-sharing tool) |
| Versions Affected | Versions with P2P sharing running in --no-ai mode (per GHSA-6pjj-r955-34rr) |
| Language / Platform | Python 3 (PoC); target is a cross-platform terminal-sharing daemon |
| Authentication Required | No |
| Network Access Required | Yes |
Summary
ZAI-Shell exposes a peer-to-peer terminal-sharing feature that listens on a TCP socket and accepts a simple JSON-line protocol (hello / command messages). When the host starts a sharing session with --no-ai (no_ai_mode), commands received over this P2P channel are executed directly on the host without requiring the normal AI-mediated approval/sanitization step and without any authentication of the connecting peer. Any remote party able to reach the listening port can therefore submit arbitrary shell commands for execution. The PoC is a minimal Python socket client that connects, performs the hello handshake, and sends an attacker-supplied command string.
Vulnerability Details
Root Cause
The P2P command-execution path in ZAI-Shell lacks authentication/authorization and, when no_ai_mode is active, bypasses the AI-assisted command review/approval gate that would otherwise mediate execution — resulting in unauthenticated command execution on the host running the shared session.
Attack Vector
- Victim starts a P2P sharing session on ZAI-Shell with
share start --no-ai, opening a listener (default port 5757). - Attacker connects to the listening TCP port and sends a JSON
hellohandshake message. - Attacker sends a JSON
commandmessage containing an arbitrary OS command. - Because
no_ai_modeis enabled, the host executes the command directly (or with reduced/no scrutiny), returning output over the same socket.
Impact
Unauthenticated remote code execution on any host running a ZAI-Shell P2P session in --no-ai mode.
Environment / Lab Setup
Target: Host running ZAI-Shell with an active P2P session started via `share start --no-ai`
Attacker: Python 3 (standard library only — socket, json)
Proof of Concept
PoC Script
See
CVE-2026-25807.pyin this folder.
| |
The script opens a raw TCP socket to the target, performs the hello handshake expected by the P2P protocol, then sends a command JSON message; any response (command output or an approval prompt trigger) is printed to the console.
Detection & Indicators of Compromise
Signs of compromise:
- Unexplained shell command execution or new processes spawned by the ZAI-Shell process
- Connections to the P2P listening port from IPs outside the expected sharing peer set
- Sessions running with
--no-ai/no_ai_modeenabled on internet-reachable hosts
Remediation
| Action | Detail |
|---|---|
| Primary fix | No vendor patch confirmed as of 2026-07-05 — monitor GHSA-6pjj-r955-34rr for an upstream fix |
| Interim mitigation | Avoid running P2P sharing sessions with --no-ai on networks reachable by untrusted peers; firewall the P2P port to trusted IPs only; require authentication/pairing before accepting commands |
References
Notes
Mirrored from https://github.com/ibrahmsql/CVE-2026-25807-Exploit on 2026-07-05.
| |