subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
if dry_run: print(f" [DRY RUN] {cmd}") return None result = subprocess.run(cmd, shell=True, capture_output=True, text=True) if result.returncode != 0: print(f" [ERROR] {cmd}") print(f" stderr: {result.stderr.strip()}")- Confidence
- 97% confidence
- Finding
- The helper executes a dynamically constructed shell command via `subprocess.run(..., shell=True)`. In this script, `cmd` incorporates attacker-controllable values such as `agent_id`, `timezone`, descriptions, and especially inlined prompt text, so shell metacharacters or quote breaking can lead to command injection and arbitrary command execution.
