subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
print(json.dumps({"ok": True, "mode": "dry-run", "validation": validation, "render": rendered}, ensure_ascii=False, indent=2)) raise SystemExit(0) proc = subprocess.run(command, shell=True, text=True, capture_output=True) result = { "ok": proc.returncode == 0, "mode": "apply",- Confidence
- 99% confidence
- Finding
- This code executes a rendered command string with shell=True, which turns any unsafe content in the renderer output into shell syntax. Because the command is derived from a JSON spec processed by another script, a malicious or malformed spec can potentially reach shell execution and trigger arbitrary command execution on the host.
