subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
print(f"📌 {name}") print(f"{'='*60}") result = subprocess.run(command, shell=True, capture_output=False, text=True) if result.returncode != 0: print(f"❌ {name} 失败")- Confidence
- 95% confidence
- Finding
- The code executes shell commands via `subprocess.run(..., shell=True)` using a command string assembled with interpolated paths. Even though the current arguments are internally constructed, using the shell creates an unnecessary command-injection surface if `script_dir`, invocation context, or future changes introduce attacker-controlled content. In an automation skill that may run unattended, any command execution primitive is especially sensitive.
