/

CVE-2026-40502

Severity:

HIGH RISK

(8.8)

Missing Authorization in OpenHarness Gateway

CVE-2026-40502

Analyzed

Vulnerability type

Category:

Missing Authorization

CWE:

CWE-862

Impact:

Privilege Escalation and Unauthorized Administrative Control

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

OpenHarness gateways prior to commit dd1d235 expose administrative chat commands to remote users without proper authorization checks.

By abusing the insufficient distinction between local-only and remote-safe commands in the gateway handler, a remote user with chat access can invoke sensitive commands like /permissions full_auto and change permission modes of a running instance without operator approval.

Affected context

This vulnerability affects OpenHarness deployments where:

  • A gateway component exposes chat-based control interfaces to remote users
  • Administrative commands are multiplexed with regular chat commands through the same handler
  • The gateway does not reliably enforce a separation between local-only (trusted operator) commands and remote-safe (unprivileged) commands

In such environments, any user who can establish a remote chat session to the gateway may be able to trigger commands intended only for operators.

Exploit preconditions

  • Attack surface: Remote chat interface exposed by the OpenHarness gateway
  • Required access: Ability to authenticate or otherwise gain chat access to the gateway (e.g., as a normal remote user or integration)
  • Trigger point: Sending specially crafted chat messages that use administrative command syntax (e.g., /permissions ...)
  • Why exploitation is possible: The gateway handler does not consistently enforce authorization boundaries between local-only, privileged commands and remote-safe, unprivileged commands, allowing remote chat input to reach administrative command handlers.

Why this happens

The root cause is a missing authorization control on sensitive administrative commands within a shared gateway handler.

Both local operator commands and remote chat commands are processed through the same logical pathway, but without a robust check that the caller is authorized to execute privileged operations.

This aligns with CWE-862: Missing Authorization, where the system fails to verify that a user has the required permissions before performing security-sensitive actions.

Conceptually, the command dispatcher treats all incoming chat messages as if they originated from a trusted local operator, instead of enforcing clear, role-based distinctions and execution contexts for administrative functions.

Potential impact

  • Remote users may change permission modes (e.g., enabling full_auto or equivalent permissive modes)
  • Unauthorized elevation of privileges for themselves or other users
  • Bypassing operator approval workflows and safety checks
  • Alteration of security or operational policies at runtime
  • Facilitation of further compromise due to weakened access controls

General mitigation guidance

Mitigation focuses on strictly enforcing authorization boundaries and separating administrative control paths from general chat functionality.

Recommended defensive patterns include:

  • Implement explicit authorization checks for every administrative command, based on authenticated identity and role
  • Use distinct execution contexts or endpoints for operator-only commands that are not reachable via general remote chat interfaces
  • Introduce an allowlist of commands permitted from remote users, defaulting all others to local-only or admin-only by design
  • Apply least privilege to command semantics, ensuring that high-impact operations (e.g., permission mode changes) require elevated roles or out-of-band confirmation
  • Centralize access-control logic so that new commands automatically inherit safe defaults and do not silently bypass checks

How teams detect issues like this

Detection typically involves combining code-level and operational visibility:

  • Static analysis and code review:
  • Search for command dispatchers that process both local and remote inputs without explicit role or origin checks
  • Flag handlers that invoke administrative or configuration-changing routines without verifying authorization
  • Review chat/gateway interfaces for shared command parsers and missing access-control annotations
  • Policy and configuration review:
  • Validate that administrative command sets are mapped to restricted roles and cannot be invoked by generic chat users
  • Runtime monitoring:
  • Log all execution of sensitive commands (e.g., permission changes) with caller identity and origin, and alert on anomalous remote usage

Automated security review tools can assist by highlighting functions reachable from network-facing handlers that modify permissions or security-critical state without prior authorization checks.

Sources

SourceLink
github.comgithub.com/HKUDS/OpenHarness/commit/dd1d235450dd987b20bff01b7bfb02fe8620a0af
github.comgithub.com/HKUDS/OpenHarness/pull/127
vulncheck.comvulncheck.com/advisories/openharness-remote-administrative-command-injection-via-gateway-handler

Frequently asked

questions

Yes. As long as an attacker can gain chat access to the exposed OpenHarness gateway, they may be able to invoke administrative commands remotely without being an authorized operator.

The attacker generally needs valid chat access to the gateway—this could be a low-privileged or integration account, depending on the deployment. They do not need direct access to the host or local operator console to exploit the flaw.

The safest approach is to enforce strict, centralized authorization checks for every administrative command and ensure that operator-only commands cannot be executed from remote chat contexts. Administrative capabilities should be bound to explicit roles and, where possible, isolated behind separate control channels.

Adopt a defense-in-depth access-control model: clearly separate administrative and user functions, define roles and permissions early in the design, require authorization checks at all sensitive entry points, and use code review or automated rules to prevent new commands from bypassing established authorization logic.

Find out what's already
exploitable in your codebase.