/

CVE-2026-27175

Severity:

CRITICAL RISK

(9.8)

OS Command Injection in MajorDoMo rc/index.php Execution

CVE-2026-27175

Analyzed

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Unauthenticated Remote Code Execution

Severity:

CRITICAL RISK

(9.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

MajorDoMo contains an unauthenticated OS command injection vulnerability where user-controlled input is interpolated directly into a shell command string and later executed with exec() without sanitization.

By abusing a web-accessible queue worker and a timing window in its polling loop, an attacker can inject shell metacharacters that are executed on the server within seconds, resulting in full remote code execution.

Affected context

The vulnerability occurs in MajorDoMo deployments where:

  • The rc/index.php endpoint is exposed and accepts user-supplied parameters
  • The $param value is interpolated into a shell command within double quotes
  • Commands are queued via safe_exec() and stored in a database table
  • The cycle_execs.php script is web-accessible without authentication
  • The worker script uses exec() to run queued commands without escaping or validation

In this context, any HTTP client that can reach these endpoints can influence shell commands executed by the server.

Exploit preconditions

  • Attack surface: Public or internal HTTP access to both rc/index.php and cycle_execs.php.
  • Required access level: No authentication required; attacker only needs network reachability.
  • Trigger point:
  1. Attacker first calls cycle_execs.php, which:
  • Empties the existing command queue
  • Enters a polling loop querying for new commands
  1. While the worker is polling, attacker sends a request to rc/index.php with a crafted $param containing shell metacharacters.
  2. The queued command is picked up and passed to exec() while the polling loop is active.
  • Why exploitation is possible:
  • User input is embedded directly into a shell command within double quotes with no escaping (no escapeshellarg() or equivalent).
  • The safe_exec() function only enqueues the command and does not sanitize it.
  • cycle_execs.php retrieves the command and passes it straight to exec().
  • The polling loop creates a small race window during which newly queued commands are executed quickly, enabling predictable exploitation.

Why this happens

The underlying defect is a classic OS command injection pattern mapped to CWE-78: Improper Neutralization of Special Elements used in an OS Command.

Instead of treating user-supplied data as opaque values, the code constructs a shell command by interpolating the $param variable inside double quotes. Double-quoted strings in the shell still interpret metacharacters such as command separators, subshells, and redirections when not properly escaped.

The abstraction layers (safe_exec() for queuing and cycle_execs.php as the worker) do not enforce any input validation, escaping, or parameterization. As a result, untrusted HTTP input flows unmodified into exec(), where the shell expands it as executable syntax. The command queue design further obscures the data flow, but does not mitigate the risk, because trust boundaries are not enforced at any stage.

Potential impact

  • Remote execution of arbitrary OS commands with the privileges of the MajorDoMo process
  • Full compromise of the underlying host (file read/write, lateral tooling installation)
  • Exfiltration or tampering of application data and configuration
  • Deployment of backdoors, cryptominers, or other persistent malware
  • Use of the compromised host as a pivot point for lateral movement within the network
  • Disruption of home automation or building management controlled by MajorDoMo

General mitigation guidance

Effective mitigation focuses on eliminating direct shell construction from untrusted input and tightening trust boundaries in the execution pipeline.

Recommended defensive patterns include:

  • Avoid shell invocation for business logic: Prefer direct language-level APIs or libraries (e.g., PHP functions, database clients, HTTP clients) instead of wrapping operations in shell commands.
  • Use safe command execution primitives: When shelling out is unavoidable, use interfaces that do not invoke a shell, or pass arguments as arrays so that the runtime handles escaping.
  • Apply strict input validation and normalization: Constrain parameters to a whitelist of allowed values (enums, fixed command names, numeric identifiers) before they reach any execution path; reject or log unexpected patterns early.
  • Isolate command builders and sanitize at the boundary: Centralize any command construction in a dedicated module that enforces escapeshellarg()/equivalents and disallows shell metacharacters.
  • Enforce least privilege and isolation: Run the application and worker processes under minimally privileged accounts and, where feasible, inside containers or sandboxes to limit blast radius if an injection occurs.
  • Harden auxiliary endpoints: Restrict access to worker scripts such as cycle_execs.php using authentication, network ACLs, or moving them off the public attack surface.

How teams detect issues like this

Detection typically combines code-centric and behavioral approaches:

  • Static analysis and linting:
  • Flag use of exec(), system(), shell_exec(), or backtick operators that are passed variables derived from request parameters.
  • Identify string concatenation or interpolation of untrusted input into command strings, especially when wrapped in quotes.
  • Trace data flows from HTTP input ($_GET, $_POST, $_REQUEST) through intermediate functions like safe_exec() to any OS command execution APIs.
  • Targeted code review:
  • Examine any queuing or scheduling frameworks that eventually trigger shell commands and confirm that input validation is applied before execution.
  • Look for helper functions (e.g., safe_exec()) that imply safety but lack actual sanitization or validation logic.
  • Check that worker scripts (like cycle_execs.php) are either non-public or enforce authentication and authorization.
  • Runtime and log analysis:
  • Monitor logs for unusual commands or parameters containing shell metacharacters (e.g., ;, &&, |, backticks).
  • Deploy endpoint detection tools or audit rules to alert on anomalous child processes spawned by the web server or PHP runtime.
  • Automated review tools:
  • Integrate SAST tools with rules for OS command injection patterns into CI pipelines.
  • Use web application security scanners that specifically probe for command injection across accessible endpoints.

Sources

SourceLink
chocapikk.comchocapikk.com/posts/2026/majordomo-revisited/
github.comgithub.com/sergejey/majordomo/pull/1177
vulncheck.comvulncheck.com/advisories/majordomo-command-injection-in-rcindexphp-via-race-condition

Frequently asked

questions

Yes. If rc/index.php and cycle_execs.php are reachable over the network (and especially if exposed to the internet), a remote attacker can exploit the issue without any credentials.

No. The described behavior occurs on web-accessible endpoints that do not enforce authentication, so exploitation only requires network access to the affected URLs.

The most robust fix is to remove shell command construction from user-controlled data entirely—replace shell-based operations with direct PHP or API calls, or use non-shell execution APIs that take argument arrays and validate all inputs against strict allowlists.

Institute a development guideline that bans building shell commands from request parameters, enforce central validation for any data crossing trust boundaries, and add static analysis checks in CI to flag uses of command execution functions that are fed by untrusted input.

Find out what's already
exploitable in your codebase.