subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
"""Helper: Run command via SSH. Returns (output, exit_code).""" ssh_cmd = f"ssh {user}@{host} '{command}'" try: output = subprocess.check_output(ssh_cmd, shell=True, timeout=timeout, text=True, stderr=subprocess.STDOUT) return output.strip(), 0 except subprocess.CalledProcessError as e: return e.output or "", e.returncode- Confidence
- 99% confidence
- Finding
- `_run_ssh_command` builds a shell string with untrusted `user`, `host`, and especially `command`, then executes it with `shell=True`. This creates both local shell-injection risk on the machine running the skill and remote command-injection risk through unsafe quoting, allowing an attacker controlling service configuration to execute arbitrary commands.
