subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
custom_cmd = os.environ.get("IMPROVE_LLM_CMD") if custom_cmd: try: result = subprocess.run(custom_cmd.split(), input=prompt, capture_output=True, text=True, timeout=timeout) if result.returncode == 0 and result.stdout.strip(): return result.stdout.strip()- Confidence
- 89% confidence
- Finding
- The command comes from the IMPROVE_LLM_CMD environment variable and is executed without validation. Although split() avoids shell metacharacter expansion, an attacker who can influence the environment can redirect execution to an arbitrary binary or script, causing unauthorized code execution in the agent context.
