/

CVE-2026-35582

Severity:

HIGH RISK

(8.8)

OS Command Injection in Emissary Executrix.getCommand()

CVE-2026-35582

Analyzed

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78, CWE-116

Impact:

Arbitrary Command Execution in JVM Process Context

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

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 .cfg files
  • 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 .cfg files, 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 -c command 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 .cfg files, 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 .cfg files 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.

Sources

SourceLink
github.comgithub.com/NationalSecurityAgency/emissary/commit/1faf33f2494c0128f250d7d2e8f2da99bbd32ae8
github.comgithub.com/NationalSecurityAgency/emissary/security/advisories/GHSA-3p24-9x7v-7789

Frequently asked

questions

Not in the traditional network sense. Exploitation requires the ability to modify Emissary .cfg files, which is typically a local or administrative capability. However, if configuration is managed through centralized systems or automation pipelines, compromise of those systems can translate into effective remote exploitation.

An attacker needs permissions equivalent to a place author or configuration maintainer: the ability to create or change .cfg files specifying IN_FILE_ENDING and OUT_FILE_ENDING values. No additional API, UI, or network access to Emissary is required.

Refactor command construction so that:

  • Commands are executed without going through a shell wherever possible (e.g., using argument-array APIs), and
  • All configuration-driven elements that must appear in the command are either strictly allowlisted (e.g., fixed suffixes) or passed as separate, non-shell-parsed arguments that don't require escaping.

Adopt a defensive design policy that:

  • Treats all configuration data as untrusted by default
  • Bans or heavily restricts the use of /bin/sh -c and other shell interpreters with concatenated command strings
  • Mandates centralized, tested escaping utilities for any remaining shell use
  • Integrates security-focused code review and static analysis checks specifically for command construction and configuration-driven execution paths.
Find out what's already
exploitable in your codebase.