/

CVE-2026-26068

Severity:

CRITICAL RISK

(9.9)

Command Injection in emp3r0r C2 Agent Metadata Handling

CVE-2026-26068

Analyzed

Vulnerability type

Category:

Command Injection

CWE:

CWE-77, CWE-78

Impact:

Remote Code Execution on the C2 Operator Host

Severity:

CRITICAL RISK

(9.9)

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

emp3r0r C2 accepted untrusted agent metadata (such as Transport and Hostname) during check-in and later interpolated these values directly into tmux shell command strings that were executed via /bin/sh -c.

This behavior allows a malicious or compromised agent to inject arbitrary shell commands and achieve remote code execution on the C2 operator host when the crafted metadata is processed.

Affected context

The vulnerability exists in emp3r0r C2 deployments where:

  • Agents can supply or influence metadata fields like Transport and Hostname during check-in
  • The C2 server constructs tmux commands using these metadata fields
  • Commands are executed via /bin/sh -c on the operator host

It is most relevant when operators manage multiple agents, including those in untrusted or potentially compromised environments, where agent-supplied values should not be treated as trustworthy input.

Exploit preconditions

  • Attack surface: C2 control channel between agents and the emp3r0r operator host
  • Required access: Ability to run or compromise an emp3r0r agent, or otherwise send crafted check-in data to the C2 server
  • Trigger point: Processing of agent check-in metadata, where Transport and Hostname are interpolated into tmux command strings
  • Why exploitation is possible: Unvalidated, unescaped agent-controlled strings are embedded into shell command lines executed via /bin/sh -c, allowing command separators and shell metacharacters to alter command flow

Why this happens

The core issue is direct interpolation of untrusted input into shell command strings that are executed by /bin/sh -c.

This maps to CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection') and CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

Instead of treating agent metadata as opaque data and passing it as separate, safely-encoded arguments, the application builds tmux command lines using string concatenation or formatting, allowing specially crafted values to break out of the intended command and introduce arbitrary shell syntax.

Potential impact

  • Remote execution of arbitrary shell commands on the C2 operator host
  • Full compromise of the C2 server, including access to all connected agents' data and tasking
  • Installation of backdoors or persistence mechanisms on the operator infrastructure
  • Exfiltration or tampering with operator-side logs, configurations, and operational tooling
  • Use of the compromised C2 server as a pivot point into adjacent systems and networks

General mitigation guidance

Effective mitigation focuses on eliminating direct shell construction with untrusted input and reducing trust in agent-supplied metadata:

  • Avoid building shell command strings with concatenation or interpolation of any untrusted values; instead, use APIs that accept argument lists (e.g., exec-style calls without a shell) when invoking tmux or other tools.
  • Treat agent metadata (Transport, Hostname, and similar fields) as untrusted data and ensure they are never used as raw shell fragments or command-line templates.
  • Apply strict validation and normalization to metadata fields: enforce allowed character sets, length limits, and expected formats (for example, hostnames matching RFC-compliant patterns).
  • When shell usage is unavoidable, apply robust escaping and quoting to all data arguments and restrict allowed characters to the minimum needed.
  • Run the C2 server under a dedicated, minimally privileged account with restricted filesystem and process permissions to limit blast radius if similar issues occur.
  • Isolate C2 infrastructure from other critical systems using network segmentation, and apply host-level hardening (MAC/RBAC policies, locked-down sudo, minimal installed tooling).

How teams detect issues like this

High-level detection can focus on both code patterns and runtime behavior:

  • Static analysis and code review:
  • Search for locations where agent metadata (Transport, Hostname, or similar fields) flows into command construction, especially into tmux invocation code.
  • Flag any use of /bin/sh -c, system-like wrappers, or subprocess APIs with shell=True combined with string concatenation or formatting of untrusted data.
  • Establish secure coding guidelines that prohibit shell execution with untrusted input and enforce them in pull-request reviews.
  • Automated security scanning:
  • Use static analysis tools configured with rules for command injection (CWE-77/CWE-78) to highlight dangerous sinks and tainted data flows.
  • Integrate these checks into CI pipelines so that new uses of shell execution with untrusted input are blocked before deployment.
  • Runtime and operational monitoring:
  • Monitor the C2 operator host for unusual tmux invocations or child processes spawned from the C2 server process.
  • Collect and analyze process command-lines and logs for unexpected shell metacharacters or anomalous Hostname/Transport values associated with command execution.

Sources

SourceLink
github.comgithub.com/jm33-m0/emp3r0r/commit/0cd64e4a26e7839a9a54bca3d756a665fcb7fda0
github.comgithub.com/jm33-m0/emp3r0r/releases/tag/v3.21.1
github.comgithub.com/jm33-m0/emp3r0r/security/advisories/GHSA-h5p4-4xp4-vjpp

Frequently asked

questions

Yes. An attacker who can operate or compromise an emp3r0r agent and communicate with the C2 server can send crafted metadata during check-in, which may lead to remote code execution on the operator host when that metadata is used to build shell commands.

The attacker needs control over an agent or the ability to mimic an agent's check-in behavior to supply malicious Transport or Hostname values. Direct interactive access to the C2 host is not required; exploitation occurs via the C2 communication channel.

The most robust fix is to stop using /bin/sh -c with strings that contain untrusted input. Use process execution APIs that accept argument arrays without invoking a shell, treat metadata as opaque data, and ensure any required user-controlled values are validated and passed as separate arguments rather than embedded in command lines.

Establish a rule that untrusted data must never be interpolated into shell commands or other executable contexts. Reinforce this with secure coding standards, taint-aware static analysis, code review checklists focused on command construction and input validation, and architectural patterns that avoid shells for control operations wherever possible.

Find out what's already
exploitable in your codebase.