subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
"""运行命令并显示进度""" print(f"{Fore.CYAN}[{description}]{Style.RESET_ALL}") try: result = subprocess.run(cmd, shell=True, check=True, capture_output=True, text=True) print(f"{Fore.GREEN}✓ 完成{Style.RESET_ALL}") return True except subprocess.CalledProcessError as e:- Confidence
- 88% confidence
- Finding
- The helper executes shell commands with shell=True, which is dangerous because any current or future caller that passes untrusted input into cmd can trigger shell metacharacter expansion and command injection. In this file the present call sites are developer-controlled, so the immediate exploitability is limited, but the API design is unsafe and easy to misuse.
