subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
def run_cmd(cmd: str, timeout: int = 30) -> tuple[bool, str]: try: result = subprocess.run(cmd, shell=True, capture_output=True, text=True, timeout=timeout) return result.returncode == 0, result.stdout + result.stderr except Exception as e: return False, str(e)- Confidence
- 94% confidence
- Finding
- The helper executes shell commands with `shell=True`, which makes any interpolated data part of a shell command line rather than a structured argument list. In this file, `open_page()` inserts a URL into the command string, so a crafted or unexpected URL containing shell metacharacters could trigger command injection and arbitrary local command execution.
