Skip to content

Security: Command injection via shell=True in emulator process management#425

Merged
veadex merged 2 commits intoOpenWSGR:mainfrom
tomaioo:fix/security/command-injection-via-shell-true-in-emul
Apr 13, 2026
Merged

Security: Command injection via shell=True in emulator process management#425
veadex merged 2 commits intoOpenWSGR:mainfrom
tomaioo:fix/security/command-injection-via-shell-true-in-emul

Conversation

@tomaioo
Copy link
Copy Markdown
Contributor

@tomaioo tomaioo commented Apr 12, 2026

Summary

Security: Command injection via shell=True in emulator process management

Problem

Severity: High | File: autowsgr/emulator/os_control/macos.py:L22

The macOS emulator manager builds shell commands with f-strings and executes them with shell=True (e.g., pgrep -f {self._process_name}, open -a {self._path}, pkill -9 -f {self._process_name}, and MuMu tool invocations). If self._process_name, self._path, or related config-derived values are attacker-controlled (directly or via a malicious config file), this can lead to arbitrary command execution on the host.

Solution

Avoid shell=True and pass argument lists to subprocess (subprocess.run([...], check=True)). Strictly validate/allowlist executable paths and process names from config. Reject values containing shell metacharacters and resolve paths safely before execution.

Changes

  • autowsgr/emulator/os_control/macos.py (modified)

tomaioo and others added 2 commits April 12, 2026 13:17
The macOS emulator manager builds shell commands with f-strings and executes them with `shell=True` (e.g., `pgrep -f {self._process_name}`, `open -a {self._path}`, `pkill -9 -f {self._process_name}`, and MuMu tool invocations). If `self._process_name`, `self._path`, or related config-derived values are attacker-controlled (directly or via a malicious config file), this can lead to arbitrary command execution on the host.

Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
@veadex veadex merged commit 2ee2aa0 into OpenWSGR:main Apr 13, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants