subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
def info(msg): print(f"{BLUE}[i]{NC} {msg}") def run_cmd(cmd): result = subprocess.run(cmd, shell=True, capture_output=True, text=True) return result.stdout.strip(), result.returncode # =============================================- Confidence
- 98% confidence
- Finding
- run_cmd executes a string with shell=True, which is dangerous because any caller that passes package-controlled or user-influenced text can trigger shell metacharacter interpretation and command injection. In this file it is currently used with a constant command, but the helper is generic and the unsafe primitive remains present in a migration tool that processes untrusted package contents.
