subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
"""Run a remote command via SSH and return (returncode, stdout, stderr)""" full_cmd = self.ssh_base + [cmd] try: proc = subprocess.run(full_cmd, capture_output=True, text=True, timeout=timeout) return proc.returncode, proc.stdout, proc.stderr except subprocess.TimeoutExpired: return -1, "", f"SSH command timed out after {timeout}s"- Confidence
- 94% confidence
- Finding
- The SSH wrapper executes arbitrary shell command strings on the remote host, and several callers build those strings with untrusted values such as skill names, log filters, and ports. While subprocess.run is invoked without a local shell, the remote ssh target still interprets the final argument as a shell command, so this becomes remote command injection on the managed server.
