subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
# Open in browser open_cmd = f'browser open --url "{file_url}"' result = subprocess.run(open_cmd, shell=True, capture_output=True, text=True) if result.returncode != 0: print(f"❌ Failed to open browser: {result.stderr}")- Confidence
- 98% confidence
- Finding
- This command is built as a shell string and executed with shell=True while embedding a user-controlled path-derived URL. An attacker can supply a crafted html_path containing shell metacharacters or command-substitution syntax so the shell executes unintended commands, leading to arbitrary command execution in the context of the script.
