GHSA-4wr3-f4p3-5wjh: PraisonAI: Unauthenticated Allow-List Manipulation Bypasses Agent Tool Approval Safety Controls
SummaryThe gateway's `/api/approval/allow-list` endpoint permits unauthenticated modification of the tool approval allowlist when no `auth_token` is configured (the default). By adding dangerous tool names (e.g., `shell_exec`, `file_write`) to the allowlist, an attacker can cause the `ExecApprovalManager` to auto-approve all future agent invocations of those tools, bypassing the human-in-the-loop safety mechanism that the approval system is specifically designed to enforce.DetailsThe vulnerability arises from the interaction of three components:**1. Authentication bypass in default config**`_check_auth()` in `server.py:243-246` returns `None` (no error) when `self.config.auth_token` is falsy:`GatewayConfig` defaults `auth_token` to `None` (`config.py:61`):**2. Unrestricted allowlist modification**The `approval_allowlist` handler at `server.py:381-420` calls `_check_auth()` and proceeds when it returns `None`:There is no validation that `tool_name` corresponds to a real tool, no restriction on which tools can be allowlisted, and no rate limiting.**3. Auto-approval fast path**When `GatewayApprovalBackend.request_approval()` is called by an agent (`gateway_approval.py:87`), it calls `ExecApprovalManager.register()`, which checks the allowlist first (`exec_approval.py:141-144`):The tool executes immediately without any human review.**Complete data flow:**Attacker POSTs `{"tool_name": "shell_exec"}` to `/api/approval/allow-list``_check_auth()` returns `None` (no auth token configured)`_approval_mgr.allowlist.add("shell_exec")` adds to the `PermissionAllowlist` setAgent later calls `shell_exec` → `GatewayApprovalBackend.request_approval()` → `ExecApprovalManager.register()``register()` hits the fast path: `"shell_exec" in self.allowlist` → `True`Returns `Resolution(approved=True)` — no human review occursAgent executes the dangerous toolPoCImpact**Bypasses human-in-the-loop safety controls**: The approval system is the primary safety mechanism preventing agents from executing dangerous operations (shell commands, file writes, code execution) without human review. Once the allowlist is manipulated, all safety gates for the specified tools are permanently disabled for the lifetime of the gateway process.**Enables arbitrary agent tool execution**: Any tool can be added to the allowlist, including tools that execute shell commands, write files, or perform other privileged operations.**Persistent within process**: The allowlist is stored in-memory and persists for the entire gateway lifetime. There is no audit log of allowlist modifications.**Local attack surface**: Default binding to `127.0.0.1` limits this to local attackers, but any process on the same host (malicious scripts, compromised dependencies, SSRF from other local services) can exploit this. When combined with the separately-reported CORS wildcard origin (CWE-942), this becomes exploitable from any website via the user's browser.Recommended FixThe approval allowlist endpoint is a security-critical function and should always require authentication, even in development mode. Apply one of these mitigations:**Option A: Require auth_token for approval endpoints (recommended)****Option B: Restrict allowlist additions to known safe tools**
CVSS v3.1: 7.9