{"vuln_id":"GHSA-ffp3-3562-8cv3","aliases":["CVE-2026-56074"],"description":"PraisonAI: Coarse-Grained Tool Approval Cache Bypasses Per-Invocation Consent for Shell Commands","published_at":"2026-07-13T14:36:52.273166Z","modified_at":"2026-11-20T12:00:02.407855Z","first_seen_at":"2026-11-21T19:15:56.678633Z","severity":"medium","severity_source":"cvss","cvss_score":5.5,"cvss_vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N","cwe":[],"vendor":null,"product":null,"kev":{"is_kev":false,"date_added":null,"due_date":null,"ransomware":false},"epss":null,"epss_percentile":null,"nvd_status":null,"enriched_at":null,"links":{"nvd":"https://github.com/advisories/GHSA-ffp3-3562-8cv3"},"matched_alias":null,"items":[{"id":10665,"source":{"id":"osv","name":"OSV.dev"},"title":"PYSEC-2026-2946: PraisonAI: Coarse-Grained Tool Approval Cache Bypasses Per-Invocation Consent for Shell Commands","summary":"PraisonAI: Coarse-Grained Tool Approval Cache Bypasses Per-Invocation Consent for Shell Commands\n\n## Summary\n\nThe approval system in PraisonAI Agents caches tool approval decisions by tool name only, not by invocation arguments. Once a user approves `execute_command` for any command (e.g., `ls -la`), all subsequent `execute_command` calls in that execution context bypass the approval prompt entirely. Combined with `os.environ.copy()` passing all process environment variables to subprocesses, this allows an LLM agent (potentially via prompt injection) to silently exfiltrate API keys and credentials without further user consent.\n\n## Details\n\nThe `require_approval` decorator in `src/praisonai-agents/praisonaiagents/approval/__init__.py:176-178` checks approval status by tool name only:\n\n```python\n@wraps(func)\ndef wrapper(*args, **kwargs):\n    if is_already_approved(tool_name):   # line 177 — checks only tool_name\n        return func(*args, **kwargs)     # line 178 — bypasses ALL approval\n```\n\nThe `mark_approved` function in `registry.py:144-147` stores only the tool name string:\n\n```python\ndef mark_approved(self, tool_name: str) -> None:\n    approved = self._approved_context.get(set())\n    approved.add(tool_name)              # stores \"execute_command\", not args\n    self._approved_context.set(approved)\n```\n\nThe approval context is never cleared during agent execution — `clear_approved()` exists (`registry.py:152`) but is never called in the agent's tool execution path (`agent/tool_execution.py`).\n\nMeanwhile, the `ConsoleBackend` UI at `backends.py:95-96` misleads the user:\n\n```python\nreturn Confirm.ask(\n    f\"Do you want to execute this {request.risk_level} risk tool?\",\n    # \"this\" implies per-invocation approval\n)\n```\n\nThe UI displays the specific command arguments (lines 81-85), creating a reasonable expectation that the user is approving only that specific invocation.\n\nAdditionally, `shell_tools.py:77` passes the full process environment to every subprocess:\n\n```python\nprocess_env = os.environ.copy()  # includes OPENAI_API_KEY, etc.\n```\n\nThere is no command filtering, blocklist, or environment variable sanitization in the shell tools module.\n\n## PoC\n\n```python\nfrom praisonaiagents import Agent\nfrom praisonaiagents.tools.shell_tools import execute_command\n\n# Step 1: Create agent with shell tool\nagent = Agent(\n    name=\"worker\",\n    instructions=\"You are a helpful assistant.\",\n    tools=[execute_command]\n)\n\n# Step 2: Agent requests benign command — user sees Rich panel:\n#   Function: execute_command\n#   Risk Level: CRITICAL\n#   Arguments:\n#     command: ls -la\n#   \"Do you want to execute this critical risk tool?\" [y/N]\n# User approves → mark_approved(\"execute_command\") is called\n\n# Step 3: All subsequent execute_command calls bypass approval silently:\n# execute_command(command=\"env\")\n#   → returns ALL environment variables (OPENAI_API_KEY, AWS_SECRET_ACCESS_KEY, etc.)\n#   → NO approval prompt shown\n\n# Step 4: Targeted extraction also bypasses approval:\n# execute_command(command=\"printenv OPENAI_API_KEY\")\n#   → returns the specific API key\n#   \n\nAffected: PyPI:praisonaiagents\n\nFixed in: 4.5.128\n\nReferences:\nhttps://github.com/MervinPraison/PraisonAI/security/advisories/GHSA-ffp3-3562-8cv3\nhttps://nvd.nist.gov/vuln/detail/CVE-2026-56074\nhttps://github.com/MervinPraison/PraisonAI\nhttps://github.com/MervinPraison/PraisonAI/releases/tag/v4.5.128\nhttps://www.vulncheck.com/advisories/praisonai-tool-approval-cache-bypass-via-coarse-grained-caching\nhttps://pypi.org/project/praisonaiagents\nhttps://github.com/advisories/GHSA-ffp3-3562-8cv3","url":"https://osv.dev/vulnerability/PYSEC-2026-2946","published_at":"2026-07-13T14:36:52.273166Z","updated_at":"2026-11-20T12:00:02.407855Z","fetched_at":"2026-11-21T19:15:55.946087Z","severity":"medium","cvss_score":5.5,"epss":0.00176,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"praisonaiagents","vuln_id":"CVE-2026-56074","vuln_ids":["CVE-2026-56074","GHSA-FFP3-3562-8CV3","PYSEC-2026-2946"],"tags":["osv","pypi","fix-available"],"cluster_id":10642,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/10665","html":"https://vulnwatch.ve1ve2.com/item/10665"}}]}