subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
return True, "(delegated / no run command)" try: # 用 utf-8 + errors=replace 防御 Windows 控制台非 UTF-8 代码页导致的崩溃 r = subprocess.run(step["run"], shell=True, capture_output=True, encoding="utf-8", errors="replace", timeout=60) out = (r.stdout or "") + (r.stderr or "") return (r.returncode == 0), out.strip()- Confidence
- 98% confidence
- Finding
- The code executes `step["run"]` via `subprocess.run(..., shell=True)`, which allows arbitrary shell command execution from the loop definition. If `loop.json` is untrusted or attacker-influenced, this becomes direct command injection and can lead to arbitrary code execution, data theft, or system modification.
