subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
# Execute the command start = datetime.now(pytz.UTC) try: result = subprocess.run(task['command'], shell=True, capture_output=True, text=True, timeout=300) success = result.returncode == 0 output = result.stdout[-1000:] if result.stdout else '' error = result.stderr[-1000:] if result.stderr else ''- Confidence
- 99% confidence
- Finding
- The task runner executes task['command'] with shell=True, which allows arbitrary shell metacharacters, chaining, redirection, and subshell expansion. Because commands are stored from user input and can later be executed on demand, this creates a direct arbitrary command execution primitive in the agent environment.
