subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
def run_command(cmd, timeout=120): """运行命令并返回结果""" try: result = subprocess.run( cmd, shell=True, capture_output=True,- Confidence
- 99% confidence
- Finding
- The code builds a shell command string from user-controlled values (`input_file` and `output_dir`) and executes it with `subprocess.run(..., shell=True)`. Quoting with double quotes is not sufficient to prevent shell metacharacter expansion such as command substitution, so a crafted filename like `$(id).docx` can lead to arbitrary command execution under the tool's privileges.
