Join our Newsletter — 33% off our NHI Course
Home› Glossary› AI Security› Function-call injection
AI Security

Function-call injection

← Back to Glossary
By NHI Mgmt Group Updated October 8, 2026 Domain: AI Security

A pattern where an attacker manipulates model output so it is accepted as a valid tool request by the host application. The risk is not just prompt wording. It is the trust placed in structured output that can trigger privileged actions or unsafe execution.

How function-call injection works

Function-call injection happens when a model's structured output is treated as an executable tool request rather than just text. The attack succeeds because the host application trusts the shape of the response, not because the prompt alone is persuasive.

This makes the boundary between generation and action the critical security seam. A harmless-looking response can become a command to retrieve data, call an API, modify state, or trigger another workflow if the application routes it into a tool executor without sufficient validation.

Why it is different from ordinary prompt injection

Ordinary prompt injection tries to steer the model's answer. Function-call injection tries to steer the application's behavior by exploiting the parser, dispatcher, or orchestration layer that turns model output into tool invocation. The real target is the control plane around the model, not just the model itself.

That distinction matters because the consequences are often operational, not merely linguistic. If the host accepts attacker-shaped arguments, the model can become a relay for unauthorized actions even when the generated wording looks syntactically valid and internally consistent.

Where the security boundary breaks

The failure usually sits in one of three places: weak schema validation, overbroad tool permissions, or unsafe assumptions about model honesty. Structured output can still be malicious if the application fails to constrain which tools may be called, which arguments are acceptable, and which actions require additional approval.

Systems that blend natural language with automation often need the same discipline you would apply to any privileged API surface. The output must be treated as untrusted input until it passes policy checks, authorization checks, and context checks appropriate to the action being requested.

For a broader view of the application-security baseline, the OWASP Top 10 remains the simplest reference point for understanding why untrusted input should never flow directly into privileged behavior.

Common abuse patterns and failure modes

Attackers often aim for tool calls that retrieve secrets, expose sensitive records, submit unwanted transactions, or chain into additional internal actions. In practice, the danger is magnified when the application assumes the model will only emit well-formed requests and does not separately verify intent, scope, or user authorization.

The other common failure is overconfidence in the model's own guardrails. A model can be socially or contextually manipulated into producing a valid function call that the host system should have rejected at the orchestration layer. The weakness is the trust relationship between generated structure and executed privilege.

For teams securing AI-enabled integrations, the OWASP API Security Top 10 is useful because many failures in function-call injection resemble API authorization and object-access defects once the request reaches the backend.

Risk and Threat Considerations

Function-call injection matters because it can convert a model output compromise into unauthorized execution, data exposure, or business-logic abuse. The risk is highest when the application grants the model access to sensitive tools, privileged workflows, or state-changing actions without a strong trust boundary.

Failure mechanism: An attacker shapes the model response so the host application interprets attacker-controlled output as a legitimate function call, then forwards it to a privileged tool or backend action.

Impact: This can produce unauthorized API calls, data theft, unwanted transaction execution, privilege abuse, or chained compromise across connected systems.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP API Security Top 10 addresses the attack and risk surface, while OWASP ASVS and NIST SP 800-53 Rev 5 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
OWASP ASVSV8 — AuthorizationFunction-call injection turns model output into privileged action, so authorization controls are directly relevant.
Recommendation — Enforce function-level authorization checks before executing any model-proposed action.
OWASP API Security Top 10API5 — Broken Function Level AuthorizationThe attack abuses acceptance of attacker-shaped function calls that the backend should reject.
API6 — Unrestricted Access to Sensitive Business FlowsTool calls can drive sensitive workflows such as transfers, updates, or destructive changes.
Recommendation — Validate that each tool invocation is allowed for the current user and context before dispatching it. Gate sensitive workflow actions with additional approval or step-up checks.
NIST SP 800-53 Rev 5AC-6 — Least PrivilegeLimiting tool permissions reduces the blast radius of a successful injected function call.
IA-5 — Authenticator ManagementFunction-call injection often becomes severe when secrets or tokens can be reused to invoke protected actions.
Recommendation — Constrain each tool and backend identity to the minimum actions it needs. Protect and rotate credentials used by automation paths that can be reached through model output.

Practitioner Guidance

Why practitioners should care: Treat tool invocation as an authorization problem, not just a prompt-formatting problem. If a model can trigger actions, the application needs explicit policy enforcement around which functions are available, which inputs are allowed, and when human or programmatic approval is required.

Common misunderstanding: A syntactically valid function call is not the same thing as a safe one. The caller, the context, and the requested action still need independent validation before execution.

Practitioner takeaway: The safest pattern is to make the model propose action and make the host application decide whether the action is permitted.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on October 8, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org