Summary
Emissary's Executrix utility class previously constructed shell commands by concatenating configuration-derived values, such as the PLACE_NAME parameter, with minimal sanitization.
Because only spaces were replaced with underscores, shell metacharacters could flow directly into /bin/sh -c, allowing attackers who control these parameters to inject arbitrary commands.
Affected context
This vulnerability occurs in Emissary deployments where the Executrix utility class is used to spawn shell commands based on configuration or workflow parameters.
It is relevant when values like PLACE_NAME originate from user, workflow, or external system input that is not strictly controlled and then get embedded into command strings passed to /bin/sh -c.
The issue does not manifest if all such configuration parameters are fully trusted and never influenced by untrusted actors, but that is difficult to guarantee in complex, distributed workflows.
Exploit preconditions
- Attack surface: Any workflow or API path that influences configuration-derived parameters (e.g., PLACE_NAME) that Executrix uses to build shell commands.
- Required access: Ability to control or modify these configuration values or workflow fields, either directly (configuration write access) or indirectly (supplying input that is later stored in configuration).
- Trigger point: Execution of the affected Emissary workflow step where Executrix builds a command string and invokes
/bin/sh -c. - Why exploitation is possible: The command is assembled via string concatenation with only spaces replaced by underscores, allowing shell metacharacters (
;,|,$, backticks, parentheses, etc.) to be interpreted by the shell as control operators or subcommands.
Why this happens
The fundamental bug is unsafe construction of shell commands from externally influenced data without robust validation or escaping.
Instead of treating PLACE_NAME and similar configuration values as opaque data passed to well-typed APIs, the Executrix class builds a single shell command string and hands it to /bin/sh -c.
Replacing spaces with underscores addresses only whitespace issues and does not neutralize shell metacharacters, which map directly to CWE-78: Improper Neutralization of Special Elements used in an OS Command.
This pattern allows attacker-controlled input to break out of the intended argument context and inject additional commands or modify the behavior of the underlying process.
Potential impact
- Execution of arbitrary OS commands with the privileges of the Emissary process.
- Access to local files and sensitive data reachable from the Emissary host or container.
- Modification or deletion of workflow data, intermediate artifacts, or configuration.
- Use of the compromised node as a pivot point for lateral movement within the environment.
- Disruption of workflow execution, including denial of service for dependent systems.
General mitigation guidance
Effective mitigation centers on eliminating string-based shell command construction and reducing the trust boundary of configuration-derived values.
Recommended patterns include:
- Prefer direct API calls or language-native libraries over shelling out where possible (e.g., use filesystem or network APIs instead of
shcommands). - When shelling out is unavoidable, use process execution APIs that accept argument arrays (e.g.,
execve-style orProcessBuilder/subprocesswithshell=False) so that user input is never interpreted by a shell. - Constrain configurable parameters to strict, validated formats (e.g., whitelisting allowed characters or matching against known-safe patterns such as
[A-Za-z0-9_-]+). - Apply least-privilege principles to the Emissary runtime so that even if a command is compromised, the resulting process has minimal permissions.
- Treat configuration values as untrusted unless clearly proven otherwise, and avoid embedding them directly into command lines or scripts.
How teams detect issues like this
Detection typically involves both code-centric and configuration-centric analysis:
- Static analysis: Create rules to flag uses of
/bin/sh -c,Runtime.exec(String),subprocesswithshell=True, or equivalent patterns where external or configuration-derived data flows into command strings without proper neutralization. - Code review signals: Look for utility classes that build commands through string concatenation, especially when they reference parameters like PLACE_NAME, user-supplied fields, or dynamic workflow metadata.
- Configuration review: Periodically audit workflow and job definitions to identify fields that are interpolated into shell commands and ensure they are constrained to safe values.
- Runtime monitoring: Use command auditing or process monitoring to detect unexpected shell invocations or anomalous command patterns originating from Emissary workflows.
- Automated security testing tools, including SAST and taint-analysis engines, can help surface dangerous data flows into OS command execution APIs early in development.

