subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
env.setdefault("SKILL_CACHE_WORKSPACE", _get_workspace()) try: result = subprocess.run(cmd, capture_output=True, text=True, timeout=30, env=env) stdout = result.stdout.strip() if result.stdout else "" if raw_output:- Confidence
- 88% confidence
- Finding
- The code executes an external Python script via subprocess using a script path and interpreter path that can be overridden by environment variables. Although it avoids shell=True, this still creates a command-execution surface because a hostile environment can redirect execution to an attacker-controlled binary or script. In an agent/skill environment, trust boundaries around environment variables are often weak, which makes this more dangerous than a normal local utility call.
