Security Guides

Attack Prevention Guides

Specific attack + framework combinations with real payloads, vulnerable vs secure code, and detection strategies. Each guide covers why your framework is vulnerable to this specific attack and exactly how to prevent it.

How to Use These Attack Prevention Guides

Each guide targets a specific attack type + framework combination. Rather than generic security advice, you get the exact vulnerability in your framework, real attack payloads that exploit it, and the specific code to prevent it. Every guide includes vulnerable vs. secure code side-by-side so you can see exactly what changes.

Start by finding your framework in the tags below, then pick the threat type most relevant to your deployment. If you're not sure which threats apply to you, start with the prompt injection guide for your framework — it's the most common attack vector across all agent types.

Attacks:Prompt InjectionData ExfiltrationTool ManipulationPrivilege EscalationPolicy ViolationBehavioral Anomaly
Frameworks:LangChainOpenAIAnthropic ClaudeCrewAIMCP

Prompt Injection

LangChain

How to Prevent Prompt Injection in LangChain Agents

LangChain agents are uniquely vulnerable to prompt injection because they combine LLM reasoning with tool access and document retrieval. A single injected instruction in a retrieved document can cause the agent to execute arbitrary tool calls, leak data, or ignore its system prompt entirely.

OpenAI

How to Prevent Prompt Injection in OpenAI Agents

OpenAI function calling agents are vulnerable to prompt injection attacks that manipulate the model into generating malicious function calls. Unlike simple chatbots, function calling agents execute real actions — making injection attacks operational, not just informational.

Anthropic Claude

How to Prevent Prompt Injection in Claude Agents

Claude's 200K context window and sophisticated tool use make it a powerful agent backbone, but the large context window is a double-edged sword for security. Attackers have 200K tokens of space to hide injection attempts — far more than any human reviewer can check manually.

CrewAI

How to Prevent Prompt Injection in CrewAI Workflows

CrewAI's multi-agent architecture amplifies prompt injection risk exponentially. When an injection compromises one agent, its manipulated output flows to the next agent as trusted input — cascading the attack through the entire crew.

MCP

How to Prevent Prompt Injection via MCP Servers

MCP servers are a novel injection vector. When your agent calls an MCP tool, the server controls the response — and a malicious or compromised server can return tool results containing injected instructions that hijack your agent's behavior.

Data Exfiltration

Tool Manipulation

Privilege Escalation

Policy Violation

Behavioral Anomaly

Frequently Asked Questions

Which guide should I start with?

Start with the prompt injection guide for your framework. Prompt injection is the most common attack (14% of sessions) and the gateway to most other attacks. Once you've secured against injection, move to data exfiltration and tool manipulation guides.

Do I need framework-specific protection or is generic security enough?

Framework-specific protection is significantly more effective. Each framework has unique attack surfaces — LangChain's callback system, CrewAI's inter-agent communication, MCP's tool protocol. Generic security misses framework-specific vulnerabilities that attackers actively exploit.

Can I use these guides without Rune?

Yes — each guide includes general prevention strategies that work independently. However, the detection code examples use Rune's SDK because manual implementation of multi-layer scanning (pattern matching + semantic analysis + LLM judgment) requires significant engineering effort to build and maintain.

How often are new guides added?

We add guides whenever a new attack technique or framework integration is identified. The threat landscape for AI agents evolves rapidly — new injection techniques emerge monthly. Follow our blog for announcements of new guides and threat reports.

Protect your agents from every attack vector

Add runtime security in under 5 minutes. Rune scans every input, output, and tool call automatically.

Start Free — 10K Events/Month
AI Agent Security Guides — Attack Prevention by Framework | Rune