subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
def cmd(cmd: str, cwd=None, shell=True): print(f"\n>>> {cmd}") result = subprocess.run(cmd, cwd=cwd, shell=shell, capture_output=False) return result.returncode == 0- Confidence
- 98% confidence
- Finding
- The helper wraps subprocess.run with shell=True and accepts a prebuilt command string, creating a command-injection sink. In this script, that sink is later fed values derived from user-controlled project names, topic text, and model-generated prompts, so an attacker can break out of quoting and execute arbitrary shell commands on the host.
