Summary
OpenHuman desktop agent's supervised SecurityPolicy shell command allowlist can be bypassed to execute arbitrary operating system commands as the desktop user.
By abusing incomplete flag filtering in find and environment-variable based hooks in allowlisted tools, an attacker can turn seemingly benign commands into remote code execution via prompt injection.
Affected context
This vulnerability affects OpenHuman desktop agent deployments that use the default Supervised SecurityPolicy and rely on the shell command allowlist as the primary sandbox.
The issue arises when the agent executes allowlisted shell commands on behalf of users, including commands derived from untrusted content processed by large language models.
Environments where the agent is allowed to run shell commands in the user's session, and where untrusted documents, emails, calendar items, or web pages are ingested, are particularly exposed.
Exploit preconditions
- Attack surface: The agent's shell execution interface exposed through LLM-driven task automation.
- Required access: Ability to influence or control content that the agent processes (for example, documents, emails, calendar events, or web pages that the agent indexes or follows instructions from).
- Trigger point: The agent following instructions that cause it to invoke:
findwith-execdiror-okdirflags; or- allowlisted commands such as
gitwhere behavior is altered via environment variables (e.g.,GIT_EXTERNAL_DIFF,GIT_SSH_COMMAND). - Why exploitation is possible:
- The
is_args_safe()validation blocks only-execand-okbut not the equivalent-execdirand-okdir, which still execute arbitrary commands for each matched file. - The
skip_env_assignments()logic strips leadingKEY=valueenvironment assignments before checking against the allowlist, soGIT_EXTERNAL_DIFF=<cmd> git diffis validated as justgit diff. - When executed in a shell, the environment-based hooks cause the user-specified command to run, bypassing the intended sandbox.
Why this happens
The root cause is an incomplete and context-unaware command allowlisting approach that operates on tokenized arguments rather than effective shell behavior.
In policy.rs, is_args_safe() attempts to filter dangerous find options but only blacklists -exec and -ok, missing the semantically equivalent -execdir and -okdir flags that also spawn arbitrary commands.
Simultaneously, skip_env_assignments() removes leading KEY=value prefixes before validation, assuming these are benign environment assignments; however, many tools (like git) expose powerful, environment-controlled hooks.
This combination maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command and CWE-184: Incomplete Blacklist, where security relies on fragile partial blocking instead of a precise, positive security model tied to actual execution semantics.
Potential impact
- Remote execution of arbitrary OS commands under the privileges of the desktop user.
- Data exfiltration from local files, application data directories, and mounted network shares.
- Arbitrary file read, write, and modification within the user's permissions.
- Credential theft via access to SSH keys, browser profiles, or other secrets in the user's home directory.
- Lateral movement to other systems reachable from the compromised host.
- Manipulation or poisoning of agent-visible data and downstream automations.
General mitigation guidance
Effective mitigation focuses on strengthening command validation semantics and reducing reliance on shell parsing:
- Favor capability-based APIs (e.g., direct library calls for file operations, Git operations, and search) instead of invoking generic shell commands from the agent.
- Replace blacklist-style argument filtering with strict, enumerated allowlists of:
- permitted binaries;
- permitted subcommands; and
- tightly scoped argument patterns and flags.
- Treat leading environment-variable assignments as part of the security-sensitive surface:
- either disallow them entirely in agent-issued commands; or
- validate them explicitly against a schema of safe keys and constrained values.
- Avoid constructs like
find -exec*entirely in sandboxed contexts; if file iteration is needed, implement it via language-level APIs without shell callbacks. - Run agent-executed commands in a constrained execution environment (e.g., separate unprivileged user, chroot/container, restricted file-system view) so that a policy bypass has reduced impact.
- Apply the principle of least privilege for the agent, limiting access to only the directories and services it strictly needs to operate.
How teams detect issues like this
High-level detection can combine code-centric and runtime approaches:
- Static analysis and code review:
- Flag uses of shell invocation helpers that construct commands from user or model-controlled inputs.
- Identify command validation routines that rely on substring or incomplete blacklist checks, especially around powerful utilities like
find,git,ssh, or interpreters. - Review logic that strips or ignores parts of the command (such as environment assignments) before security checks.
- Policy and configuration review:
- Audit command allowlists to ensure they model actual tool semantics and do not depend solely on banning "dangerous-looking" flags.
- Enforce internal guidelines discouraging
-exec,-execdir,-ok,-okdir, and similar execution flags in sandboxed tooling. - Runtime monitoring:
- Instrument agent sessions to log executed commands and arguments, with alerts on suspicious patterns like
find ... -execdir, unexpected environment-variable hooks, or outbound data transfers. - Use host-level EDR or command auditing to detect unusual sub-process trees spawned from the agent process.
- Automated review tools (SAST/linters) can be configured with custom rules to detect incomplete blacklisting and shell-command construction patterns early in development.

