/

CVE-2026-25807

Severity:

HIGH RISK

(8.8)

Remote Command Injection / Improper Authentication

CVE-2026-25807

Analyzed

Vulnerability type

Category:

Remote Command Injection / Improper Authentication

CWE:

CWE-94

Impact:

Remote Command Execution with User Privileges

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

ZAI Shell's P2P terminal sharing feature exposed an unauthenticated TCP socket on port 5757 that allowed remote connections without any access control.

When running in --no-ai mode, a connected attacker could inject arbitrary system commands into the shared session, which may be executed with the host user's privileges if approved without review, bypassing Sentinel safety checks.

Affected context

This vulnerability affects environments where ZAI Shell is used with the P2P terminal sharing feature (share start) prior to version 9.0.3.

The risk is highest when:

  • The host user starts a P2P session that listens on TCP port 5757
  • The session is reachable over a network (local, corporate, or internet-exposed)
  • ZAI Shell is run in --no-ai mode, relying on user approval instead of automated Sentinel checks

In such setups, remote parties can connect to the open socket and inject commands into the user approval workflow.

Exploit preconditions

  • Attack surface: Network-exposed TCP port 5757 opened by the P2P terminal sharing feature (share start).
  • Required access: Ability to reach the host over the network on port 5757 (no prior authentication required).
  • Trigger point: An active ZAI Shell P2P session running in --no-ai mode with terminal sharing enabled.
  • User interaction: The host user must approve incoming commands, but may do so without carefully reviewing the content.
  • Why exploitation is possible: The P2P listener lacks authentication and input origin verification, allowing any remote party to submit arbitrary command strings that, once approved, execute with the host user's privileges and circumvent Sentinel safety protections.

Why this happens

The core issue is the combination of:

  • An unauthenticated network endpoint for command submission, and
  • Direct mapping of received strings to executable system commands under user control.

This aligns with CWE-94: Improper Control of Generation of Code ('Code Injection'), because the system accepts externally supplied command text over a network socket and uses it as executable logic without robust origin verification, authorization, or additional safety guards when in --no-ai mode.

Conceptually, the feature treats remote, untrusted input as if it were trusted local commands within an interactive session, relying solely on user approval as the last safety barrier.

Potential impact

  • Remote execution of arbitrary system commands with the host user's privileges
  • Bypass of internal Sentinel safety checks in --no-ai sessions
  • Unauthorized access to sensitive files and data on the host system
  • Installation of malware, persistence mechanisms, or backdoors
  • Lateral movement to other systems reachable from the compromised host
  • Disruption of services, data tampering, or environment misconfiguration

General mitigation guidance

Effective mitigation involves both design-level controls and operational safeguards:

  • Introduce strong authentication for P2P terminal sharing endpoints so only trusted peers can connect.
  • Bind P2P sessions to restricted interfaces or private networks to limit unsolicited remote access.
  • Implement strict input validation and separation between proposed commands and execution mechanisms.
  • Add clear, high-friction confirmation UX for executing remotely supplied commands (e.g., full diff views, highlighting of dangerous patterns).
  • Enforce least-privilege execution for the ZAI Shell environment to limit damage if commands are executed.
  • Provide configuration options to disable remote command submission entirely or restrict it to read-only collaboration modes.
  • Encourage users to review every incoming command thoroughly instead of relying on habitual approval.

How teams detect issues like this

Organizations can detect and monitor for this class of issue using a combination of code and runtime analysis:

  • Static analysis and review:
  • Flag network listeners that accept command or script content over unauthenticated channels.
  • Identify code paths where received strings are passed directly to command execution APIs or shells.
  • Review features that expose CLI or terminal control over the network, ensuring they enforce authentication and authorization.
  • Policy and configuration enforcement:
  • Enforce secure defaults via policy (e.g., P2P sharing disabled or restricted unless authenticated).
  • Integrate secure coding guidelines for interactive agents and remote collaboration features.
  • Runtime monitoring:
  • Monitor for unexpected listeners on port 5757 (or similar collaboration ports) on production endpoints.
  • Log and review remote commands executed through P2P sessions, correlating with user approvals and session context.
  • Automated security tooling (SAST/DAST) can be configured to highlight unauthenticated command channels and high-risk remote execution flows during development and testing.

Sources

SourceLink
github.comgithub.com/TaklaXBR/zai-shell/commit/a4ea8525d912f55d6e2f09b2869966c52d189a4a
github.comgithub.com/TaklaXBR/zai-shell/releases/tag/v9.0.3
github.comgithub.com/TaklaXBR/zai-shell/security/advisories/GHSA-6pjj-r955-34rr

Frequently asked

questions

Yes. Any attacker who can reach TCP port 5757 on a host running a ZAI Shell P2P session can connect without authentication and submit commands. Execution still depends on the host user approving those commands.

No prior local or account-level authentication is required. The only requirement is network connectivity to the exposed P2P port and an active terminal sharing session in --no-ai mode.

The safest pattern is to enforce strong authentication and authorization on all remote command or collaboration channels, and to avoid directly executing remote input as commands. Where remote proposals are needed, they should be treated as untrusted suggestions with robust checks and explicit, high-visibility user confirmation.

Apply secure-by-design principles: require authentication for any network-accessible control surface, design remote collaboration as "view or suggest only" by default, separate input proposal from execution, run with least privilege, and subject any remote-execution or terminal-sharing feature to focused security review and threat modeling before release.

Find out what's already
exploitable in your codebase.