subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
# 兜底实现 import subprocess cmd = f"mcporter call exa.web_search_exa query='{query}' numResults={num_results}" result = subprocess.run(cmd, shell=True, capture_output=True, text=True) return result.stdout- Confidence
- 98% confidence
- Finding
- The fallback path builds a shell command with the user-influenced query interpolated directly into a string and executes it with shell=True. This enables command injection: an attacker can craft query text containing shell metacharacters to execute arbitrary commands in the agent environment.
