subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
] for candidate in candidates: try: result = subprocess.run([candidate, "--version"], capture_output=True, text=True, encoding="utf-8", errors="replace") if result.returncode == 0 or result.stdout or result.stderr: return candidate except FileNotFoundError:- Confidence
- 84% confidence
- Finding
- The code resolves openclaw.cmd by searching PATH and accepts any executable that produces output for --version, even if it exits nonzero. In an attacker-controlled environment, a malicious binary earlier in PATH could be selected and then later executed with user-influenced arguments, leading to arbitrary code execution under the skill's privileges.
