Command injection

rexec executes a command string on the server, and where that string is built from attacker-influenced input by a wrapper, script, or application that calls rexec unsafely, shell metacharacters inject additional commands. This extends a single intended command into arbitrary execution as the account running it.

1 min di letturaaggiornato il 7 ott 2026florianamette1 contributore
Chiedi al tuo assistente (MCP)Modifica su GitHub

rexec is designed to execute the authenticated user's supplied command, so arbitrary remote command execution with valid credentials is expected behavior rather than command injection. A separate injection vulnerability can arise when a wrapper, web front-end, or management script concatenates attacker-controlled input into a shell command that invokes rexec. Depending on where quoting fails, metacharacters may execute locally in the wrapper's context or become part of the remote command string.

bash
# vulnerable wrapper pattern: attacker-controlled $report_name is concatenated
# into a command interpreted by a shell
run_report() {
  report_name=$1
  sh -c "rexec -l report -p \"$REXEC_PASSWORD\" server 'report $report_name'"
}
# input such as: daily'; id; #
# can terminate the quoted argument and add a local command in the wrapper's context

Exploitation notes#

  • The flaw is in the caller, not rexecd: first establish that attacker input reaches a shell-interpreted wrapper without correct argument separation or escaping.
  • Injected commands run as whatever account performs the execution, which for automated management tooling is often privileged.
  • This is the same injection class as any unsafe shell-command construction; rexec is simply the sink. Confirm whether a shell interprets the string (metacharacters only help if a shell parses them).
  • Cleartext capture may expose credentials used by the wrapper, but possessing valid credentials and choosing a remote command is normal rexec use, not proof of injection.

References#