Summary
MiroFish up to version 0.1.2 contains a command injection vulnerability in the SimulationIPCClient.send_command function within the inter-process communication (IPC) service.
When attacker-controlled data is incorporated into OS-level commands without proper sanitization or argument separation, a remote attacker can execute arbitrary commands on the affected system.
Affected context
This vulnerability appears in the inter-process communication layer of MiroFish, specifically in backend/app/services/simulation_ipc.py within the SimulationIPCClient.send_command function.
It manifests when user-provided or remotely supplied values are concatenated into shell commands or passed to command execution APIs in a way that allows shell metacharacters or additional arguments to be interpreted by the operating system.
Deployments that expose the IPC-triggering functionality over a network or indirectly through higher-level features are more at risk, especially when inputs are not strictly validated and commands run with elevated privileges.
Exploit preconditions
- Attack surface: Remote, via any interface or API that ultimately invokes
SimulationIPCClient.send_commandwith data influenced by an attacker. - Required access: Ability to send crafted requests or messages to the IPC client or any upstream component that passes attacker-controlled data into the IPC layer.
- Trigger point: Execution of a shell or subprocess command built from untrusted input inside
send_command. - Why exploitation is possible: The command string is likely constructed by concatenating or interpolating raw input into a shell command, and then executed via an API that invokes a shell or interprets metacharacters, enabling injection of additional commands or arguments.
Why this happens
The underlying issue is improper construction of OS commands using untrusted data, mapping directly to CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection') and related to CWE-74: Improper Neutralization of Special Elements in Output.
Instead of treating user-controlled values as data-only parameters to a subprocess API, the IPC client appears to build a command line string that the shell parses, allowing characters such as ;, &&, |, or backticks to alter the command structure.
This pattern turns configuration or user input into executable logic, granting attackers influence over what the operating system runs whenever the IPC mechanism is triggered.
Potential impact
- Remote execution of arbitrary OS commands with the privileges of the MiroFish process
- Reading, modifying, or deleting application and system files accessible to the process
- Pivoting to other internal services or hosts reachable from the affected system
- Disruption or manipulation of simulation processes managed through the IPC layer
- Installation of malware or backdoors to maintain persistent access
General mitigation guidance
Effective mitigation focuses on treating all incoming data as untrusted and preventing it from altering command structure:
- Use subprocess APIs that accept argument arrays (e.g., exec-style or list-based invocation) and avoid passing untrusted data through a shell.
- Strictly validate and whitelist allowable command options or arguments, rejecting any values that fall outside a narrowly defined set.
- Avoid constructing command strings with concatenation or interpolation; if commands must be built dynamically, separate control data from user data and escape or encode special characters appropriately.
- Run IPC-handling components with least privilege, minimizing filesystem and network access so that any compromise is contained.
- Consider alternative designs where IPC messages encode actions and parameters that are handled directly in code, rather than mapped to shell commands.
How teams detect issues like this
Detection typically combines code-centric and behavioral approaches:
- Static analysis: Flag usage of shell-invoking APIs (e.g., those that accept a single command string or
shell=True) when they receive variables derived from external input, especially in IPC-related modules. - Code review cues: Look for string concatenation or formatting used to build command lines, and trace data flow from network or IPC inputs into execution points in
simulation_ipc.py. - Policy enforcement: Enforce development guidelines that prohibit shell-based command execution in IPC paths without strict sanitization and argument separation.
- Runtime monitoring: Use host-based intrusion detection or logging to spot unusual subprocess invocations, anomalous command patterns, or unexpected child processes spawned by the MiroFish service.

