Tool and function call arguments are validated before execution
Why it matters
When a model is given tools (function calling, tool use), a successful prompt injection no longer just changes the model's words—it causes the model to call real functions with attacker-specified arguments. OWASP LLM06:2025 (Excessive Agency) directly addresses this: an AI agent that can take consequential actions without independent authorization checks is a force-multiplier for any injection. MITRE ATLAS AML.T0051 and CWE-1427 both apply to the unvalidated dispatch of tool calls. A tool that performs database writes, sends emails, or makes API calls on the model's instruction—without re-verifying authorization at the execution layer—can be triggered by an injected instruction to perform actions the authenticated user never authorized. NIST AI RMF GOVERN 1.1 requires clear boundaries around what an AI system is authorized to do.
Severity rationale
High because tool call injection converts a prompt injection vulnerability into an action injection vulnerability—successful exploitation causes real-world consequences (data mutation, email delivery, external API calls) rather than just modified text output.
Remediation
Validate tool calls at three layers: allowlist the tool name, schema-validate the arguments, and enforce authorization inside the tool function independent of the model's request.
// src/lib/tools.ts
const ALLOWED_TOOLS = ['search_docs', 'get_user_profile', 'create_draft'] as const
type AllowedTool = (typeof ALLOWED_TOOLS)[number]
for (const toolCall of completion.choices[0]?.message?.tool_calls ?? []) {
// Layer 1: allowlist check
if (!(ALLOWED_TOOLS as readonly string[]).includes(toolCall.function.name)) {
throw new Error(`Blocked unknown tool: ${toolCall.function.name}`)
}
// Layer 2: argument schema validation
const schema = ToolSchemas[toolCall.function.name as AllowedTool]
const args = schema.parse(JSON.parse(toolCall.function.arguments))
// Layer 3: authorization inside the tool function (never trusts caller intent)
await TOOL_HANDLERS[toolCall.function.name as AllowedTool](args, session)
}
The authorization check inside each tool handler is non-negotiable: it must verify the acting user has permission for the specific operation, not just that the model requested it.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the AI Prompt Injection Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- cwe · CWE-1427 — Improper Neutralization of Input Used in AI/ML Prompt Injection
- owasp-llm:2025 · LLM06 — Excessive Agency
- mitre-atlas:v4 · AML.T0051 — LLM Prompt Injection
- nist-ai-rmf:1.0 · GOVERN 1.1 — Policies, processes, procedures, and practices across organization to manage AI risks
Taxons
History
- 2026-04-18·v1.0.0·Initial import from ai-prompt-injection·automated