subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
def run_command(cmd, cwd=None, timeout=3600): """运行命令并返回输出""" try: result = subprocess.run( cmd, shell=True, cwd=cwd, capture_output=True, timeout=timeout )- Confidence
- 99% confidence
- Finding
- The helper uses subprocess.run with shell=True on command strings that are assembled from Gradio-controlled inputs throughout the file. Although many arguments are wrapped in quotes, shell metacharacters embedded in user input can still break out of quoting or alter shell behavior, leading to arbitrary command execution under the WebUI process account.
