Summary
HKUDS OpenHarness exposes a remote code execution vulnerability in the /bridge slash command that lets configured remote senders trigger arbitrary operating system commands.
By invoking the /bridge spawn command with attacker-controlled text, an attacker can cause the bridge session manager to execute those commands via a shared shell helper, running as the OpenHarness process user and accessing local files, credentials, and repository contents.
Affected context
The vulnerability occurs in OpenHarness deployments that:
- Enable the
/bridgeslash command functionality - Accept messages from remote senders as configured in the bridge integration
- Forward user-provided command text to a shell-based helper without robust validation or restriction
It primarily affects environments where the OpenHarness process user has access to sensitive filesystem paths, workspace state, or repository data on the host.
Exploit preconditions
- Attack surface: Remote over the communication channel that carries
/bridgeslash commands (e.g., chat or integration transport). - Required access: Ability to act as or control a "remote sender" that the OpenHarness bridge is configured to trust and process.
- Trigger point: Sending a
/bridge spawncommand containing attacker-chosen command text that is forwarded to the bridge session manager. - Why exploitation is possible: The implementation passes untrusted command text into a shared shell subprocess helper with insufficient sanitization or command restriction, enabling arbitrary OS command execution under the OpenHarness process user.
Why this happens
This issue stems from treating user-controlled command text as safe input to a shell execution context.
The /bridge spawn handler forwards incoming slash command arguments directly (or with inadequate validation) to a shared shell subprocess helper, which likely invokes a shell interpreter (for example, via system, popen, or equivalent APIs) rather than a strictly parameterized execution API.
This aligns with CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where special characters, operators, and argument boundaries in untrusted input are not properly neutralized or constrained before being used to form or invoke operating system commands.
Potential impact
- Remote execution of arbitrary OS commands as the OpenHarness process user
- Unauthorized access to local files, including configuration, logs, SSH keys, and cached credentials
- Reading or modifying workspace state and checked-out repository contents
- Tampering with build or test artifacts and pipeline outputs
- Establishing persistence on the host via backdoors or scheduled tasks
- Lateral movement to other systems accessible from the OpenHarness host
General mitigation guidance
Effective mitigation focuses on eliminating direct shell composition and reducing the trust placed in remote command input:
- Replace shell-based helpers with parameterized process execution APIs that pass arguments as arrays rather than concatenated strings.
- Introduce a strict allowlist of permissible commands or sub-commands, rejecting or ignoring any unexpected or free-form command text.
- Normalize and validate all remote slash command parameters, explicitly disallowing shell metacharacters, pipelines, redirects, and control operators.
- Consider implementing a dedicated command routing layer that maps high-level actions (e.g., "start session", "run tests") to fixed, server-side command templates without incorporating raw user text.
- Run the OpenHarness service under a minimally privileged OS account with restricted filesystem and network access, and isolate it using OS-level sandboxing or containerization where practical.
- Provide operators with configuration options to disable
/bridge spawnor similar high-risk features in environments that do not require them.
How teams detect issues like this
Detection typically blends code-focused and operational approaches:
- Static analysis and code review:
- Search for uses of shell invocation APIs that concatenate user-supplied data, especially in handlers for
/bridge,/bridge spawn, or similar commands. - Flag patterns where incoming text from chat or remote integrations is passed into shell helpers without strict validation or an allowlist.
- Verify that any abstraction around the "shared shell subprocess helper" never accepts raw, arbitrary command strings from untrusted sources.
- Configuration and policy checks:
- Enforce policies that prohibit unbounded remote command execution features unless explicitly justified and reviewed.
- Use secure coding guidelines that mandate parameterized process execution and disallow shell interpretation of external input.
- Runtime monitoring and logging:
- Log all uses of
/bridgeand/bridge spawnwith contextual metadata, and monitor for suspicious patterns such as chained commands, redirections, or unusual argument lengths. - Track OS-level process creation events for the OpenHarness user, alerting on anomalous command lines, interactive shells, or unexpected tools launched by the service.
- Automated security scanners and code review tools can be configured to recognize OS command injection patterns and highlight risky shell usage during CI.

