Summary
A command injection vulnerability in MariaDB's State Snapshot Transfer (SST) process allows a malicious joiner node to inject unvalidated parameters into the donor's rsync command line.
When SST is performed using the rsync method, crafted parameters from the joiner can cause arbitrary shell commands to execute on the donor node, potentially compromising the hosting system and cluster.
Affected context
This vulnerability occurs in MariaDB server deployments that use Galera or similar clustering with State Snapshot Transfer (SST) via the rsync method.
It is relevant when a donor node constructs shell commands from parameters supplied by a joiner during the SST handshake.
Environments where joiner nodes are not fully trusted, or where cluster membership can be influenced by an attacker, face heightened risk because the donor interpolates these parameters into its command line.
Exploit preconditions
- Attack surface: Cluster-internal SST protocol between donor and joiner nodes, specifically when using rsync-based SST.
- Required access: Ability to control or operate a joiner node participating in the cluster, or to inject parameters into the joiner's SST negotiation.
- Trigger point: Initiation of an SST session where the donor node constructs and runs rsync commands using joiner-provided parameter values.
- Why exploitation is possible: The donor's SST implementation interpolates joiner-supplied parameters directly into a shell command without adequate validation, escaping, or whitelisting, enabling shell metacharacters and injected subcommands to be interpreted by the shell.
Why this happens
The root cause is improper construction of shell commands using untrusted input, aligning with CWE-78: Improper Neutralization of Special Elements used in an OS Command.
During rsync-based SST, the donor node builds a command line by concatenating parameters received from the joiner, assuming they are benign.
Because these values are not strictly validated, escaped, or restricted to a safe character set or predefined set of options, an attacker can insert shell metacharacters and additional commands.
This pattern of dynamic command assembly without robust sanitization or parameterization enables arbitrary command execution in the donor's operating system context.
Potential impact
- Remote execution of arbitrary commands on the donor node during SST.
- Compromise of the donor's underlying operating system and database instance.
- Theft, modification, or destruction of data stored on the donor node.
- Use of the donor as a pivot for lateral movement within the infrastructure.
- Disruption of cluster integrity and availability by corrupting or sabotaging SST operations.
General mitigation guidance
Effective mitigation focuses on eliminating unsafe command construction and tightening trust boundaries in cluster operations:
- Replace shell-based command concatenation with safe process invocation APIs that pass arguments as structured parameters rather than a single shell-interpreted string.
- Restrict joiner-supplied values to a strict whitelist of expected options and patterns, rejecting any input containing shell metacharacters or unexpected tokens.
- Apply rigorous validation and normalization on all SST-related parameters before they influence command execution, including length limits and character-level checks.
- Run donor-side SST components with the least privileges necessary, separating them from highly privileged accounts and limiting filesystem and network access.
- Treat new or rejoining nodes as untrusted until they have passed explicit administrative approval or automated admission controls in the cluster.
How teams detect issues like this
Detection can rely on both code-centric and operational approaches:
- Use static analysis or linters to flag string-based shell command construction that incorporates network-sourced or cluster-peer input, particularly in SST and replication code paths.
- During code review, look for patterns such as direct concatenation of joiner parameters into shell commands, use of generic shell wrappers, or absence of input validation prior to command execution.
- Implement security policies that disallow unsafe shell invocation functions or require wrappers that enforce argument-safe APIs in critical database and clustering components.
- Monitor donor nodes during SST for anomalous command executions, unexpected child processes, or deviations from known-good rsync invocation patterns using system auditing and intrusion detection tools.

