Summary
Emissary's workflow engine constructs shell commands in Executrix.getCommand() by interpolating temporary file paths into a /bin/sh -c string without escaping or validation.
If a place author can control IN_FILE_ENDING or OUT_FILE_ENDING values in .cfg files, they can inject shell metacharacters and execute arbitrary OS commands in the JVM process's security context.
Affected context
This vulnerability appears in Emissary deployments that:
- Use Executrix.getCommand() to spawn external processes via
/bin/sh -c - Allow place authors or configuration maintainers to create or modify
.cfgfiles - Permit custom IN_FILE_ENDING and OUT_FILE_ENDING values in configuration
The risk is present where these file ending values are not constrained or validated, and where the Emissary process has access to sensitive system resources or data under its runtime identity.
Exploit preconditions
- Attack surface: Local configuration layer; exploitation happens through crafted
.cfgfiles, not via network APIs. - Required access: Ability to create or modify Emissary place configuration files, including IN_FILE_ENDING and OUT_FILE_ENDING values.
- Trigger point: Execution of a workflow step that calls Executrix.getCommand(), causing the framework to build and execute a shell command.
- Why exploitation is possible: Executrix concatenates untrusted file ending values into a
/bin/sh -ccommand line without escaping or input validation, while only placeName is sanitized. Shell metacharacters in the file endings are interpreted by/bin/sh, enabling arbitrary command execution.
Why this happens
The root cause is a classic command injection pattern where untrusted data is embedded into a shell command string.
Executrix.getCommand() forms a /bin/sh -c invocation using temporary file paths that directly incorporate IN_FILE_ENDING and OUT_FILE_ENDING from configuration.
Unlike placeName, which is sanitized via allowlisting, these file ending inputs are neither normalized nor restricted, leaving shell metacharacters intact.
This aligns with:
- CWE-78 (Improper Neutralization of Special Elements used in an OS Command) — shell syntax characters are not neutralized before being passed to the interpreter.
- CWE-116 (Improper Encoding or Escaping of Output) — the command-line output context is not properly escaped for the shell, allowing untrusted data to alter command structure.
Potential impact
- Execution of arbitrary OS commands with the privileges of the Emissary JVM process
- Reading, modifying, or deleting data accessible to the Emissary service account
- Installing backdoors or launching additional malicious processes on the host
- Pivoting to other internal services or resources reachable from the Emissary host
- Disruption of workflow execution, including job sabotage or data corruption
General mitigation guidance
Because this is a framework-level flaw in how Executrix.getCommand() builds commands, the most robust mitigations center on:
- Avoiding shell interpretation: Prefer APIs that execute commands without invoking
/bin/sh -c, such as direct process execution with argument arrays, so untrusted values cannot be parsed as shell syntax. - Context-aware escaping: Where shell usage is unavoidable, apply strict, centralized escaping routines for all variables interpolated into shell commands, including file endings and other path fragments.
- Input restriction and validation: Treat configuration-derived fields like IN_FILE_ENDING and OUT_FILE_ENDING as untrusted and constrain them via allowlists (e.g., fixed set of suffixes) rather than free-form strings.
- Least-privilege runtime: Run the Emissary JVM under accounts with minimal permissions and isolate it with OS-level controls (containers, sandboxing, restricted file system access) to reduce blast radius if commands are abused.
- Configuration governance: Limit who can author or modify
.cfgfiles, and introduce review or approval workflows for configuration changes that influence command construction or file naming conventions.
How teams detect issues like this
Detection typically involves both code-centric and configuration-centric approaches:
- Static analysis: Flag any code paths that build shell commands by concatenating strings with untrusted configuration values, especially those executed via
/bin/sh -c,Runtime.exec(String), or similar APIs without argument separation or escaping. - Code review signals: During manual review, scrutinize places where file names, suffixes, or user-controlled configuration fields are interpolated into command strings; verify they either bypass the shell or apply proper escaping and allowlisting.
- Configuration scanning: Periodically scan
.cfgfiles for suspicious patterns in IN_FILE_ENDING and OUT_FILE_ENDING (e.g.,;,&&,|, backticks,$() that may indicate attempted command injection. - Runtime monitoring: Enable logging of spawned commands and monitor for anomalous arguments or unexpected tool invocations originating from Emissary workflows; pair with host-based intrusion detection that can alert on unusual process trees from the Emissary JVM.

