subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
shell_cmd = " ".join(shlex.quote(c) for c in cmd) try: result = subprocess.run( shell_cmd, shell=True, capture_output=True, text=True, timeout=timeout, ) except subprocess.TimeoutExpired:- Confidence
- 93% confidence
- Finding
- The code builds a shell command string and executes it with shell=True. Although arguments are shell-quoted, product/api/params can still be influenced by upstream inputs and shell invocation unnecessarily expands the attack surface, making command execution semantics dependent on the shell and increasing risk of command or parameter injection if quoting assumptions ever fail.
