subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
def run(cmd, timeout=10): try: r = subprocess.run(cmd, capture_output=True, text=True, timeout=timeout, shell=isinstance(cmd, str)) return r.stdout.strip() except Exception: return ''- Confidence
- 95% confidence
- Finding
- The helper executes any string command with shell=True, which creates a shell-injection sink if untrusted input ever reaches cmd. In this file, get_disk(path) interpolates a function argument into a shell command, so a crafted path could execute arbitrary commands under the agent's user context.
