subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
try: print("正在运行批处理脚本...") result = subprocess.run( [str(temp_script)], shell=True, capture_output=True,- Confidence
- 95% confidence
- Finding
- The code executes a batch file via subprocess.run with shell=True, and the batch content is derived from an external script_path plus unsafely interpolated source_dir and target_dir values into .bat syntax. On Windows, this can enable command injection or unintended command execution if the script file or path values contain shell metacharacters, and it broadens a file-copy helper into arbitrary command execution.
