subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
def _run_fix(cmd: str) -> tuple[bool, str]: """执行修复命令,返回 (成功, 输出)。""" try: result = subprocess.run( cmd, shell=True, capture_output=True, text=True, timeout=120 ) out = (result.stdout + result.stderr).strip()- Confidence
- 97% confidence
- Finding
- The auto-fix path executes shell commands via subprocess.run(..., shell=True) using command strings assembled elsewhere in the program. Even if current fix_cmd values are internally generated, this pattern is dangerous because any future path that allows config-derived or attacker-influenced content into fix_cmd can become command injection, and the fix mode already performs privileged state changes on files and services.
