Course contentsShow
← Security
Lesson 2860 of 3,05253. AI and ML SecurityFree lesson

LLM Plugin and Tool Security

Vulnerabilities arising when LLMs interact with external APIs, databases, and tools through function calling mechanisms.

LLM Plugin and Tool Security

What You'll Learn

You'll learn how vulnerabilities emerge when Large Language Models interact with external APIs, databases, and tools through function-calling mechanisms, and how attackers can exploit these integrations.

The Core Security Challenge

When LLMs gain the ability to "use tools"—calling external APIs, querying databases, executing code, or interacting with services—they inherit an entirely new attack surface. The LLM becomes a bridge between attacker-controlled text (prompts) and privileged actions in the real world.

Think of it like giving a helpful but gullible assistant the keys to your entire office building. If someone convinces them through conversation that they should unlock a restricted door, they'll do it—even if the request came from a malicious source.

Key Vulnerability Classes

1. Excessive Permissions: Tools granted to LLMs often have overly broad access. An LLM with a "send email" function might be tricked into sending spam or exfiltrating data.

2. Insufficient Input Validation: When an LLM generates parameters for tool calls based on user input, attackers can inject malicious payloads. For example, crafting a prompt that makes the LLM pass SQL injection strings to a database query function.

3. Confused Deputy Problem: The LLM acts on behalf of the attacker with the system's privileges, not understanding the security context. It doesn't distinguish between legitimate user requests and malicious instructions embedded in indirect prompts.

4. Chaining Attacks: Attackers combine prompt injection with tool access to create multi-stage attacks—using one tool's output to craft inputs for another, escalating privileges or extracting sensitive information.

Real-World Impact

An attacker might inject instructions into a RAG-retrieved document that instructs the LLM to use its "file access" plugin to read /etc/passwd or its "API calling" function to exfiltrate customer data to an external endpoint.

Key Takeaway: LLM tool-calling mechanisms create a critical security boundary where untrusted natural language input can directly trigger privileged system actions, requiring strict permission models, input sanitization on tool parameters, and architectural isolation between LLM reasoning and sensitive operations.