Every CVE Search/ Get API key

CVE-2026-57137

PraisonAI AgentLoop onToolCall approval runs after tool execution

8.8 HighFix available

PraisonAI is a multi-agent teams system. From 1.4.0 until 1.7.2, createAgentLoop() in src/praisonai-ts/src/ai/agent-loop.ts passes executable tools to generateText() before invoking the onToolCall approval callback. Because the wrapped AI SDK executes tool handlers during generation, a callback that returns false records tool_rejected only after the denied tool has already produced side effects and populated toolResults. Applications using onToolCall as a human or policy approval boundary can therefore execute rejected file, command, API, or data-modifying operations. This issue is fixed in version 1.7.2.

Attack profile

How easy it is to exploit

Attack vector
Network
Complexity
Low
Privileges needed
Low
User interaction
None

What an attacker can affect

Confidentiality
High
Integrity
High
Availability
High

Exploit likelihood

0.51%Up 0.1 points since Sep 15, 2026
90%50%10%1%

What each source reports

CVE List Score used 8.8

PraisonAI AgentLoop onToolCall approval runs after tool execution

PraisonAI is a multi-agent teams system. From 1.4.0 until 1.7.2, createAgentLoop() in src/praisonai-ts/src/ai/agent-loop.ts passes executable tools to generateText() before invoking the onToolCall approval callback. Because the wrapped AI SDK executes tool handlers during generation, a callback that returns false records tool_rejected only after the denied tool has already produced side effects and populated toolResults. Applications using onToolCall as a human or policy approval boundary can therefore execute rejected file, command, API, or data-modifying operations. This issue is fixed in version 1.7.2.

Record
CVE-2026-57137
CVSS 3.1
8.8 HighCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Weakness
CWE-693, CWE-862, CWE-863
Updated
2026-11-02
EUVDEUVD-2026-78422 8.8

PraisonAI is a multi-agent teams system. From 1.4.0 until 1.7.2, createAgentLoop() in src/praisonai-ts/src/ai/agent-loop.ts passes executable tools to generateText() before invoking the onToolCall approval callback. Because the wrapped AI SDK executes tool handlers during generation, a callback that returns false records tool_rejected only after the denied tool has already produced side effects and populated toolResults. Applications using onToolCall as a human or policy approval boundary can therefore execute rejected file, command, API, or data-modifying operations. This issue is fixed in version 1.7.2.

Record
EUVD-2026-78422
CVSS 3.1
8.8 HighCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Updated
2026-11-02
GitHub AdvisoriesGHSA-h2w2-v7j6-xqm4 8.8

npm PraisonAI AgentLoop onToolCall approval runs after tool execution

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:

/** 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:

onToolCall: async (toolCall) => {
  const approved = await askUserForApproval(toolCall);
  return approved;
}

However, AgentLoop.step() calls generateText() with the executable tools before invoking onToolCall:

const result = await generateText({
  model: this.config.model,
  messages: this.messages as any,
  tools: this.config.tools,
  maxSteps: 1,
});

It then materializes toolResults:

toolResults: result.toolResults.map(tr => ({
  toolCallId: tr.toolCallId,
  toolName: tr.toolName,
  result: tr.result,
})),

Only afterward does the approval callback run:

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:

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:[email protected] 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:

node poc/pov_poc.js 1.7.1

Expected output includes:

{
  "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":…
Record
GHSA-h2w2-v7j6-xqm4
CVSS 3.1
8.8 HighCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Weakness
CWE-693, CWE-862, CWE-863
Updated
2026-11-02
NVD 8.8

PraisonAI is a multi-agent teams system. From 1.4.0 until 1.7.2, createAgentLoop() in src/praisonai-ts/src/ai/agent-loop.ts passes executable tools to generateText() before invoking the onToolCall approval callback. Because the wrapped AI SDK executes tool handlers during generation, a callback that returns false records tool_rejected only after the denied tool has already produced side effects and populated toolResults. Applications using onToolCall as a human or policy approval boundary can therefore execute rejected file, command, API, or data-modifying operations. This issue is fixed in version 1.7.2.

Record
CVE-2026-57137
CVSS 3.1
8.8 HighCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Weakness
CWE-693, CWE-862, CWE-863
Updated
2026-11-02
OSV 8.8

PraisonAI AgentLoop onToolCall approval runs after tool execution

PraisonAI is a multi-agent teams system. From 1.4.0 until 1.7.2, createAgentLoop() in src/praisonai-ts/src/ai/agent-loop.ts passes executable tools to generateText() before invoking the onToolCall approval callback. Because the wrapped AI SDK executes tool handlers during generation, a callback that returns false records tool_rejected only after the denied tool has already produced side effects and populated toolResults. Applications using onToolCall as a human or policy approval boundary can therefore execute rejected file, command, API, or data-modifying operations. This issue is fixed in version 1.7.2.

Record
CVE-2026-57137
CVSS 3.1
8.8 HighCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Weakness
CWE-693, CWE-862, CWE-863
Updated
2026-11-02
OSVGHSA-h2w2-v7j6-xqm4 8.8

npm PraisonAI AgentLoop onToolCall approval runs after tool execution

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:

/** 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:

onToolCall: async (toolCall) => {
  const approved = await askUserForApproval(toolCall);
  return approved;
}

However, AgentLoop.step() calls generateText() with the executable tools before invoking onToolCall:

const result = await generateText({
  model: this.config.model,
  messages: this.messages as any,
  tools: this.config.tools,
  maxSteps: 1,
});

It then materializes toolResults:

toolResults: result.toolResults.map(tr => ({
  toolCallId: tr.toolCallId,
  toolName: tr.toolName,
  result: tr.result,
})),

Only afterward does the approval callback run:

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:

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:[email protected] 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:

node poc/pov_poc.js 1.7.1

Expected output includes:

{
  "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":…
Record
GHSA-h2w2-v7j6-xqm4
CVSS 3.1
8.8 HighCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Weakness
CWE-693, CWE-862, CWE-863
Updated
2026-11-02

Affected products

Affected packages

Affected packages
PackageAffectedFixed
praisonai
npm
1.4.0 to 1.7.1
1.7.2
praisonai
npm
1.4.0 up to 1.7.2
1.7.2

History

History
RecordedChangedSources
first indexedCVE List, EUVD, GitHub Advisories, NVD, OSV

Dates are when Every CVE recorded each change. Upstream dates may differ.

In short

CVE-2026-57137 is a high vulnerability (CVSS 8.8) in Mervinpraison Praisonai, published June 18, 2026. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.51%, the 43rd percentile. Fixed in praisonai 1.7.2.

References

This page doesn't list everything

Left out here: the rest of 2 source descriptions. The JSON record has them.

MoveEnter Open