Tainted flow: 'cmd' from os.getenv (line 56, credential/environment) → subprocess.run (code execution)
Medium
- Category
- Data Flow
- Content
] print(f"[X-CAPTURE] Running: {query} ({date_from} to {date_to})") try: result = subprocess.run(cmd, capture_output=True, text=True, timeout=90, encoding="utf-8", errors="replace") if result.returncode != 0: print(f" [WARN] x-search returned code {result.returncode}") if result.stderr:- Confidence
- 89% confidence
- Finding
- The executed script path comes from the X_SEARCH_SCRIPT environment variable, so anyone able to influence the environment can redirect execution to an arbitrary local program. Because this code automatically runs that path with the current Python interpreter, it creates a code-execution primitive in environments where skill configuration or env vars are attacker-controlled or inherited from untrusted sources.
