subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
def fix(self, issue: DiagnosticIssue) -> bool: if issue.fix_script: try: result = subprocess.run(issue.fix_script.split(), capture_output=True, text=True, shell=True) if result.returncode == 0: logger.info(f"成功修复权限: {issue.title}")- Confidence
- 98% confidence
- Finding
- This code invokes `subprocess.run(..., shell=True)` while also passing a command derived from `issue.fix_script`, which is built using filesystem paths. If a path contains shell metacharacters, an attacker could potentially trigger command injection when auto-fix runs, leading to arbitrary command execution under the user's privileges.
