subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
def run(cmd, check=True): """运行命令""" print(f"$ {cmd}") result = subprocess.run(cmd, shell=True, capture_output=True, text=True) if check and result.returncode != 0: print(f"错误: {result.stderr}") sys.exit(1)- Confidence
- 96% confidence
- Finding
- This subprocess call is a true issue because it uses shell=True on a raw command string. The helper is generic and can be reused with attacker-controlled input, making shell injection feasible anywhere it is called.
