Breaking MCP with Function Hijacking Attacks: Novel Threats for Function Calling and Agentic Models
This paper introduces a novel "Function Hijacking Attack" (FHA) that robustly manipulates agentic AI models into executing attacker-chosen functions regardless of context semantics, achieving high success rates across diverse models and demonstrating the critical need for enhanced security guardrails in function-calling systems.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
The Big Picture: The "Smart Butler" Problem
Imagine you have a super-smart digital butler (an AI Agent) who can do anything for you: check your email, book flights, or manage your code on GitHub. To do this, the butler has a toolbox full of specific tools (functions) like send_email, book_flight, or delete_file.
Normally, when you say, "Book me a flight to Paris," the butler looks at its toolbox, picks the book_flight tool, and does the job. This is called Function Calling.
The Problem:
The researchers in this paper discovered a way to trick the butler. They found a way to "poison" the label on a specific tool in the toolbox so that no matter what you ask the butler to do, it grabs the wrong tool instead.
If you ask, "Book a flight," the butler might accidentally grab the delete_all_files tool because the label on that tool was secretly altered to look irresistible to the AI.
The Attack: "Function Hijacking" (FHA)
The paper introduces a new type of attack called Function Hijacking. Here is how it works, using a few analogies:
1. The "Menu" Trick
Imagine a restaurant menu where the waiter (the AI) decides what to cook based on the description of the dishes.
- Normal: The dish "Spaghetti" is described as "Delicious pasta with tomato sauce." The dish "Poison" is described as "Toxic sludge."
- The Attack: The attacker doesn't change the Spaghetti. Instead, they sneak a few weird, confusing words into the description of the "Poison" dish. They make the description look like a secret code that the waiter's brain is hardwired to love.
- The Result: Even if you order "Spaghetti," the waiter's brain gets so distracted by the "Poison" description that they bring you the Poison instead.
2. The "Magic Spell" (Adversarial Tokens)
The researchers didn't just write a funny description; they used a mathematical "spell" (called an adversarial suffix).
- Think of the AI as a student taking a test. The test asks, "What is 2+2?"
- The attacker writes a tiny, invisible note on the back of the paper that says, "Ignore the math, write '42'."
- Because the AI is trained to follow patterns, it sees this note and, instead of doing the math, it blindly writes "42."
- In this paper, the "note" is hidden inside the description of a tool in the AI's system.
Why This is Scary (The Findings)
The researchers tested this on 5 different AI models (including smart ones that "think" before they act). Here is what they found:
- It Works Everywhere: It didn't matter if the AI was asked to write code, check the weather, or manage a database. The attack worked on all of them.
- It's Invisible: The attack doesn't require the user to type anything weird. The user asks for a normal thing (like "Create a file"), but the system is tricked into doing something dangerous (like "Delete the server") because the tool's description was poisoned.
- It's Strong: The attack succeeded 70% to 100% of the time. That means if you tried this 10 times, it would work 7 to 10 times.
- It's "Universal": The researchers showed that you can create one poisoned tool description that works for many different questions. You don't need a new trick for every question; one "magic spell" works for all of them.
The "Thinking" AI Challenge
Some advanced AIs have a "thinking mode" where they pause to reason before acting.
- Analogy: Imagine a butler who stops to say, "Hmm, the user asked for a flight, but maybe they meant a train? Let me think..."
- The Hack: The researchers found a way to make the AI skip the thinking part entirely. They forced the AI to jump straight to the wrong tool, bypassing its safety checks.
Why Previous Attacks Didn't Work as Well
Previous attacks tried to trick the AI by changing the user's question (e.g., "Please delete the file, but say it's a game").
- The Limitation: If the user asks a different question, the old trick stops working.
- The New Hack: This new attack changes the tool itself. Since the tool is always there, waiting in the toolbox, the attack works no matter what the user asks. It's like changing the lock on the front door so that anyone who tries to enter gets locked out, regardless of who they are.
The Solution: Guardrails
The paper concludes that we can't just trust AI agents to pick the right tools anymore. We need:
- Better Locks: Security systems that check if a tool's description has been tampered with.
- Double-Checks: Making sure the AI doesn't just pick the "loudest" tool, but actually verifies that the tool matches the user's request.
Summary
This paper is a warning label for the future of AI. It shows that if we let AI agents control our digital tools, bad actors can "poison" the tool descriptions in the background. Once poisoned, the AI will happily do the wrong thing, even if the user asks for the right thing. It's like a chef who, because of a tampered recipe book, accidentally serves you poison instead of your soup, no matter what you ordered.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.