subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
def run_ssh_command(ssh_cmd: str, command: str) -> tuple[str, str, int]: """Execute command via SSH and return stdout, stderr, returncode.""" full_cmd = f"{ssh_cmd} '{command}'" result = subprocess.run( full_cmd, shell=True, capture_output=True, text=True ) return result.stdout, result.stderr, result.returncode- Confidence
- 98% confidence
- Finding
- The script builds a shell command by concatenating attacker-controllable values into `full_cmd` and executes it with `shell=True`. Inputs such as `host`, `user`, `auth`, `auth_choice`, `base_url`, `model_id`, `bind`, and channel parameters can break quoting or inject additional shell syntax locally or into the remote shell, leading to arbitrary command execution and credential exposure.
