/

CVE-2026-35581

Severity:

HIGH RISK

(7.2)

OS Command Injection in Emissary Executrix Shell Command

CVE-2026-35581

Analyzed

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Remote Code Execution via Shell Command Injection

Severity:

HIGH RISK

(7.2)

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 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 sh commands).
  • When shelling out is unavoidable, use process execution APIs that accept argument arrays (e.g., execve-style or ProcessBuilder/subprocess with shell=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), subprocess with shell=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.

Sources

SourceLink
github.comgithub.com/NationalSecurityAgency/emissary/security/advisories/GHSA-6c37-7w4p-jg9v

Frequently asked

questions

It can be, if remote users or systems can influence configuration-derived parameters that Executrix uses to build shell commands. If those values are exposed via APIs, UI forms, or upstream workflow inputs, an attacker may be able to trigger command injection remotely.

The attacker must be able to control or tamper with parameters such as PLACE_NAME or similar configuration fields that end up inside the command string. This could involve direct configuration access, compromising an upstream system that writes these values, or abusing a workflow that persistently stores user input.

The safest approach is to stop constructing command lines from concatenated strings and avoid invoking a shell where possible. Use process execution APIs with argument arrays, strictly validate any user- or configuration-derived values, and ensure no untrusted data is ever interpreted by /bin/sh -c or equivalent shells.

Adopt a secure coding guideline that forbids shell-based command construction with untrusted input, enforce it via code review and static analysis, and design workflows so that configuration is treated as untrusted by default. Regular security training and automated checks for command injection patterns help ensure new features follow these practices.

Find out what's already
exploitable in your codebase.