subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
call_params['size'] = PAGE_SIZE params_json = json.dumps(call_params, ensure_ascii=False) print(f" Fetching page {page_num}...", end=" ", flush=True) result = subprocess.run([sys.executable, SKILL_SCRIPT, params_json], capture_output=True, text=True, cwd=os.environ.get("ACPX_WORKSPACES", os.getcwd()).split(os.pathsep)[0]) if result.returncode != 0: print("FAILED"); print(f" stderr: {result.stderr[:500]}"); return None saved_file = None- Confidence
- 93% confidence
- Finding
- The code launches another Python script via subprocess, and the target path is not fixed: SKILL_SCRIPT can be overridden from the SELLERSPRITE_SCRIPT environment variable. Although subprocess.run is invoked without shell=True, this still enables arbitrary code execution if an attacker can influence the environment or deployment configuration, which is especially risky in an agent/runtime context that may inherit untrusted environment state.
