GHSA-h2w2-v7j6-xqm4: praisonai: tool approval bypass executes denied actions

GHSA-h2w2-v7j6-xqm4 HIGH
Published June 18, 2026
CISO Take

PraisonAI's npm TypeScript agent loop executes registered tools before invoking the documented `onToolCall` approval callback, meaning any tool — including shell executors, file writers, or external API clients — runs even when an operator explicitly denies it. Applications relying on this callback as a human-in-the-loop or policy gate have a broken security boundary: the `tool_rejected` finish reason is emitted after the damage is done, poisoning audit logs and SIEM alerts with false denials. With a CVSS of 8.8 and exploitation requiring only the ability to submit prompts that induce a tool call, the bar for an attacker with prompt access to any exposed agent endpoint is trivially low. Upgrade `npm:praisonai` to 1.7.2 immediately and treat all prior `tool_rejected` events in affected versions as potentially executed actions pending review.

Sources: GitHub Advisory ATLAS NVD

What is the risk?

High severity (CVSS 8.8, AV:N/AC:L/PR:L/UI:N). Exploitation requires only low-privileged prompt access — no framework internals knowledge needed. Actual blast radius is tool-dependent: shell, file, and credential-bearing API tools make this effectively a remote authorization bypass with process-level privileges. The false `tool_rejected` signal actively degrades post-incident detection capability, compounding residual risk. No active exploitation or KEV listing confirmed, but the attack surface is broad in any externally-accessible multi-user agent deployment.

How does the attack unfold?

Prompt Submission
Attacker submits a crafted prompt to an exposed PraisonAI agent endpoint, inducing the LLM to generate a tool call intent targeting a powerful registered tool.
AML.T0051.000
Pre-Approval Execution
AI SDK's generateText() executes the tool's execute() handler immediately as part of text generation, completing the side effect before any approval check occurs.
AML.T0053
False Denial Emission
onToolCall fires post-execution, returns false, and PraisonAI emits finishReason: 'tool_rejected' — operator observes a denial while the side effect has already materialized.
AML.T0107
Undetected Impact
File writes, command executions, API calls, or data mutations persist undetected while audit logs record a false blocked action, enabling deniable and repeatable abuse.
AML.T0048

What systems are affected?

Package Ecosystem Vulnerable Range Patched
PraisonAI npm >= 1.4.0, <= 1.7.1 1.7.2
1 dependents 89% patched ~0d to patch Full package profile →

Do you use PraisonAI? You're affected.

How severe is it?

CVSS 3.1
8.8 / 10
EPSS
N/A
Exploitation Status
No known exploitation
Sophistication
Trivial

What is the attack surface?

AV AC PR UI S C I A
AV Network
AC Low
PR Low
UI None
S Unchanged
C High
I High
A High

What should I do?

5 steps
  1. Patch immediately: upgrade npm:praisonai to 1.7.2 where the approval check precedes tool execution.

  2. If upgrade is delayed, strip execute handlers from all tools passed to createAgentLoop() — use intent-only tool definitions and handle execution manually after explicit approval.

  3. Audit all past tool_rejected events in affected versions: treat them as potentially executed actions.

  4. Implement independent audit logging at the tool execution layer (not PraisonAI's callback layer) to restore forensic integrity.

  5. For externally-exposed deployments, sandbox tool execution at the OS level regardless of framework approval to add a defense-in-depth layer.

How is it classified?

Which compliance frameworks are affected?

This CVE is relevant to:

EU AI Act
Article 14 - Human Oversight
ISO 42001
8.4 - AI System Operation and Monitoring
NIST AI RMF
GOVERN-6.2 - Policies and procedures ensure human oversight of AI systems
OWASP LLM Top 10
LLM06 - Excessive Agency

Frequently Asked Questions

What is GHSA-h2w2-v7j6-xqm4?

PraisonAI's npm TypeScript agent loop executes registered tools before invoking the documented `onToolCall` approval callback, meaning any tool — including shell executors, file writers, or external API clients — runs even when an operator explicitly denies it. Applications relying on this callback as a human-in-the-loop or policy gate have a broken security boundary: the `tool_rejected` finish reason is emitted after the damage is done, poisoning audit logs and SIEM alerts with false denials. With a CVSS of 8.8 and exploitation requiring only the ability to submit prompts that induce a tool call, the bar for an attacker with prompt access to any exposed agent endpoint is trivially low. Upgrade `npm:praisonai` to 1.7.2 immediately and treat all prior `tool_rejected` events in affected versions as potentially executed actions pending review.

Is GHSA-h2w2-v7j6-xqm4 actively exploited?

No confirmed active exploitation of GHSA-h2w2-v7j6-xqm4 has been reported, but organizations should still patch proactively.

How to fix GHSA-h2w2-v7j6-xqm4?

1. Patch immediately: upgrade `npm:praisonai` to 1.7.2 where the approval check precedes tool execution. 2. If upgrade is delayed, strip `execute` handlers from all tools passed to `createAgentLoop()` — use intent-only tool definitions and handle execution manually after explicit approval. 3. Audit all past `tool_rejected` events in affected versions: treat them as potentially executed actions. 4. Implement independent audit logging at the tool execution layer (not PraisonAI's callback layer) to restore forensic integrity. 5. For externally-exposed deployments, sandbox tool execution at the OS level regardless of framework approval to add a defense-in-depth layer.

What systems are affected by GHSA-h2w2-v7j6-xqm4?

This vulnerability affects the following AI/ML architecture patterns: agent frameworks, human-in-the-loop pipelines, agentic tool orchestration, multi-tenant AI agent platforms.

What is the CVSS score for GHSA-h2w2-v7j6-xqm4?

GHSA-h2w2-v7j6-xqm4 has a CVSS v3.1 base score of 8.8 (HIGH).

What is the AI security impact?

Affected AI Architectures

agent frameworkshuman-in-the-loop pipelinesagentic tool orchestrationmulti-tenant AI agent platforms

MITRE ATLAS Techniques

AML.T0010.005 AI Agent Tool
AML.T0051.000 Direct
AML.T0053 AI Agent Tool Invocation

Compliance Controls Affected

EU AI Act: Article 14
ISO 42001: 8.4
NIST AI RMF: GOVERN-6.2
OWASP LLM Top 10: LLM06

What are the technical details?

Original Advisory

## Summary The published npm package `praisonai` exports `createAgentLoop()`, whose `onToolCall` callback is documented and exampled as an approval hook. The implementation calls PraisonAI's `generateText()` wrapper with the caller's executable tools first, receives `toolResults`, and only then calls `onToolCall()`. Because AI SDK `generateText()` executes tools with an `execute` function as part of the generation call, `onToolCall` can deny a tool only after the sensitive side effect has already happened. PraisonAI then returns `finishReason: "tool_rejected"`, which is a false security signal: the rejected tool already ran. The PoV is deterministic and local-only. It uses mock AI SDK modules, no live model call, no API key, and no network target. The tool increments an in-memory counter rather than touching the filesystem or executing commands. ## Technical Details In `src/praisonai-ts/src/ai/agent-loop.ts`, the public config says: ```ts /** On tool call callback (for approval) */ onToolCall?: (toolCall: ToolCallInfo) => Promise<boolean>; ``` The inline approval example also asks a user for approval and returns the decision: ```ts onToolCall: async (toolCall) => { const approved = await askUserForApproval(toolCall); return approved; } ``` However, `AgentLoop.step()` calls `generateText()` with the executable tools before invoking `onToolCall`: ```ts const result = await generateText({ model: this.config.model, messages: this.messages as any, tools: this.config.tools, maxSteps: 1, }); ``` It then materializes `toolResults`: ```ts toolResults: result.toolResults.map(tr => ({ toolCallId: tr.toolCallId, toolName: tr.toolName, result: tr.result, })), ``` Only afterward does the approval callback run: ```ts if (this.config.onToolCall) { for (const toolCall of step.toolCalls) { const approved = await this.config.onToolCall(toolCall); if (!approved) { this.complete = true; step.finishReason = 'tool_rejected'; break; } } } ``` `src/praisonai-ts/src/ai/generate-text.ts` forwards the caller's tools directly to AI SDK: ```ts const result = await sdk.generateText({ model, ... tools: options.tools, maxSteps: options.maxSteps, ... }); ``` AI SDK documents that `generateText()` "generates text and calls tools", and that tools with an `execute` function run automatically unless approval is handled before execution with `needsApproval`. The published `npm:praisonai@1.7.1` dist files preserve the same order: - `dist/ai/agent-loop.js` lines 150-157 call `generateText()` with executable tools. - lines 162-171 materialize `toolResults`. - lines 183-195 call `onToolCall()` and set `tool_rejected` afterward. ### Why This Is Not Intended Behavior This is not a trust-model-only issue. PraisonAI explicitly labels `onToolCall` as an approval callback and shows an approval example. A user who returns `false` from that callback expects the tool not to run. It also conflicts with the AI SDK execution model PraisonAI wraps: - AI SDK `generateText()` executes tools that include an `execute` function. - AI SDK approval is a pre-execution boundary (`needsApproval`), not a post-execution notification. - AI SDK loop control documentation treats "a tool call needs approval" as a condition that stops or pauses the loop before executing the tool. PraisonAI's current behavior instead creates a post-execution audit hook while naming and documenting it as approval. ## PoV Run from a local reproduction checkout: ```bash node poc/pov_poc.js 1.7.1 ``` Expected output includes: ```json { "praisonaiVersion": "1.7.1", "createAgentLoopExported": true, "eventOrder": ["tool-executed", "approval-denied"], "sideEffects": 1, "finishReason": "tool_rejected", "toolCallCount": 1, "toolResultCount": 1, "rejectedAfterExecution": true, "vulnerable": true, "patchedControl": { "order": ["approval-denied"], "sideEffects": 0, "toolCallCount": 1, "toolResultCount": 0, "blocksBeforeExecution": true } } ``` The PoV installs `npm:praisonai@1.7.1` into a temporary project and supplies mock `ai` and `@ai-sdk/openai` modules. The mocked `generateText()` returns one tool-call intent and executes a supplied `execute` handler if present. This keeps the proof deterministic and isolates PraisonAI's ordering bug. The vulnerable run uses `createAgentLoop()` with: - a `dangerousWrite` tool whose `execute()` handler increments an in-memory side-effect counter and records `tool-executed`; - an `onToolCall` approval callback that always returns `false` and records `approval-denied`. The observed order is: ```text tool-executed > approval-denied ``` That proves denial happens after execution. The `toolResults` array contains the tool's result even though PraisonAI reports `finishReason: "tool_rejected"`. The patched-control comparison strips executable handlers before the model step, requests approval on the tool-call intent, and only executes if approval succeeds. With the same denial decision, the control output is: ```text approval-denied sideEffects = 0 toolResultCount = 0 ``` ## PoC The PoV section above contains the local reproduction command, input, and decisive output. ## Impact Any application using npm PraisonAI `createAgentLoop()` with `onToolCall` as a human-in-the-loop or policy approval boundary can execute denied tools. If the application exposes the agent loop to lower-trust prompts or users and registers powerful tools, an attacker can cause the model to call a tool that the approval callback denies. The denial occurs too late. Depending on the registered tool, impact can include file modification, command execution, external API calls, data mutation, credential use, or other side effects with the privileges of the PraisonAI process. The report does not claim that npm PraisonAI exposes this as a default network service. It is a library-level approval-boundary bypass in the exported TypeScript agent-loop API. ### Severity Suggested severity: High. Rationale: - `AV`: common deployment pattern is an application exposing agent prompts over a network. - `AC`: attacker only needs to induce a tool call. - `PR`: conservative base score assumes the attacker can submit prompts to the application. - `UI`: no additional operator action is needed for the tool to execute before denial; even a denial callback is too late. - `S`: impact is in the PraisonAI-hosting application process. - `C/I/A`: depends on registered tools; shell/file/API tools can affect confidentiality, integrity, and availability. If maintainers score only local scripts that process untrusted repositories or prompts, `AV:L` may be reasonable. If they score public unauthenticated prompt endpoints built on this API, `PR:N` may be reasonable. ## Suggested Fix Do not pass executable tool handlers into `generateText()` before approval. One safe shape: 1. Convert configured tools into intent-only tool definitions without `execute`. 2. Call `generateText()` to obtain the model's tool-call intent. 3. Invoke `onToolCall(toolCall)` before any side effect. 4. Execute the selected tool only if approval returns true. 5. Append approved tool results to the conversation and continue the loop. Alternatively, if PraisonAI wants to delegate approval to AI SDK v6, translate `onToolCall` into per-tool `needsApproval` semantics so AI SDK pauses before calling `execute`. Regression tests should include: - `onToolCall` returns false and the tool `execute()` counter remains zero; - `onToolCall` returns true and the tool executes exactly once; - `tool_rejected` is never reported together with a tool result produced by the denied tool; - streaming and non-streaming loop variants use the same approval ordering if added later. ## Affected Package/Versions - Repository: `MervinPraison/PraisonAI` - Package: `npm:praisonai` - Component: TypeScript `AgentLoop` - Current head validated: `1ad58ca02975ff1398efeda694ea2ab78f20cf3e` - Current tag validated: `v4.6.58` - Latest npm package validated: `1.7.1` Suggested affected range: ```text npm:praisonai >= 1.4.0, <= 1.7.1 ``` Selected version sweep: - `1.0.0`: package main cannot be required in the selected test environment. - `1.2.0`: `createAgentLoop` is not exported. - `1.3.6`: `createAgentLoop` is not exported. - `1.4.0`: vulnerable. - `1.5.0`: vulnerable. - `1.5.4`: vulnerable. - `1.6.0`: vulnerable. - `1.7.0`: vulnerable. - `1.7.1`: vulnerable. ## Advisory History This is distinct from known and previously submitted PraisonAI issues: - `GHSA-ffp3-3562-8cv3` covers Python `praisonaiagents` approval cache keyed by tool name rather than invocation arguments. - `GHSA-qwgj-rrpj-75xm` covers Python Chainlit UI overriding configured approval mode with `auto`. - `GHSA-63v4-w882-g4x2` / poc covers Python `HTTPApproval` approval-page XSS. - poc covers npm TypeScript `AgentOS` missing authentication. - poc covers npm TypeScript `codeMode` sandbox escape. - poc covers npm TypeScript `MCPServer` missing authentication. No visible local or GitHub advisory covers npm TypeScript `AgentLoop.onToolCall` executing after tool results already exist.

Exploitation Scenario

An attacker with low-privileged prompt access to an application built on PraisonAI <= 1.7.1 submits a crafted message inducing the LLM to call a registered `writeFile` or shell tool. The operator's `onToolCall` callback is configured as a policy gate and returns `false` for unauthorized calls. However, the AI SDK's `generateText()` has already executed the tool's `execute()` handler before the callback fires — the file is written or command runs. PraisonAI returns `finishReason: 'tool_rejected'`, the application logs a blocked action, and the side effect persists undetected. In a multi-tenant scenario, this enables one user's prompt to trigger unauthorized actions under registered tool credentials with no visible trace in operator-facing logs.

Weaknesses (CWE)

CWE-693 — Protection Mechanism Failure: The product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product.

Source: MITRE CWE corpus.

CVSS Vector

CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Timeline

Published
June 18, 2026
Last Modified
June 18, 2026
First Seen
June 18, 2026

Related Vulnerabilities