← Latest papers
💬 NLP

ChatInject: Abusing Chat Templates for Prompt Injection in LLM Agents

The paper introduces ChatInject, a novel attack that exploits LLM agents' reliance on structured chat templates and persuasive multi-turn dialogues to achieve significantly higher prompt injection success rates than traditional methods, while demonstrating strong transferability and evading existing defenses.

Original authors: Hwan Chang, Yonghyun Jun, Hwanhee Lee

Published 2026-04-14
📖 4 min read☕ Coffee break read

Original authors: Hwan Chang, Yonghyun Jun, Hwanhee Lee

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

Imagine you have a very smart, helpful robot assistant. This robot is designed to do tasks for you, like checking your bank account, booking a hotel, or sending emails. To do this, it talks to other computer programs (tools) to get information.

Normally, the robot follows a strict set of rules about who gets to give it orders:

  1. The Boss (System): The robot's core programming.
  2. The Owner (User): That's you.
  3. The Helper (Assistant): The robot itself.
  4. The Data (Tool Output): Information coming from the outside world (like a bank statement or a weather report).

The rule is: The Boss and the Owner always come first. The robot should never listen to the "Data" if it tries to tell the robot to do something new. It's like a secretary who ignores a random note found in a file and only listens to the CEO or the client.

The Problem: The "Fake ID" Attack

The researchers in this paper discovered a clever way to trick this robot. They call their method ChatInject.

Think of the robot's rules like a security guard at a VIP club. The guard checks your ID (the "chat template") to see if you are allowed to enter.

  • Old Attack (Plain Text): An attacker tries to sneak in by shouting, "Hey, I'm the CEO! Let me in!" The guard looks at the ID, sees it's just a random note, and says, "Nope, that's not the CEO."
  • The New Attack (ChatInject): The attacker doesn't just shout. They forge a perfect fake ID. They dress up their malicious instruction to look exactly like a message from the "Boss" or the "Owner."

Because the robot is trained to trust these specific "ID badges" (special tags like <system> or <user>), it gets confused. It sees the fake ID, thinks, "Oh, this looks like an order from the Boss!" and immediately obeys, ignoring the real owner's actual request.

The "Persuasion" Twist (Multi-Turn)

The researchers took this a step further with a Multi-Turn variant.

Imagine the attacker doesn't just hand the robot a fake ID. Instead, they plant a scripted conversation inside the data the robot receives.

  • The Setup: The robot reads a fake chat log where a "User" asks for a weird task, and an "Assistant" agrees to do it.
  • The Trick: The robot reads this fake conversation and thinks, "Oh, I see! The user asked for this, and the assistant agreed. It must be a valid request!"
  • The Result: The robot is now "primed." It has been psychologically manipulated (persuaded) by the fake conversation to accept the malicious command as a normal part of its job.

What Did They Find?

The researchers tested this on many of the world's smartest AI models (like the ones powering advanced chatbots). Here is what happened:

  1. It Works Way Better: Traditional attacks only succeeded about 5% of the time. ChatInject succeeded 32% to 52% of the time. It's like going from a 1-in-20 chance of breaking into a house to a 1-in-2 chance.
  2. It Spreads Easily: Even if the attacker doesn't know exactly what the robot's "ID system" looks like, they can guess. If they use a fake ID that looks similar to the robot's real one, it still works. It's like wearing a suit that looks 90% like a police uniform; the robot might still let you in.
  3. Current Defenses Fail: The safety measures we have today (like "ignore anything that looks like an order") are mostly useless against this. The robot is so trained to follow the "chat format" that it can't tell the difference between a real order and a fake one wearing a fake uniform.

Why Should We Care?

This is a wake-up call. As we build more AI agents that can interact with the real world (buying things, changing passwords, sending money), we are relying on them to distinguish between "data" and "instructions."

This paper shows that if an attacker can make their "data" look like an "instruction" by using the robot's own language rules, the robot will happily obey. It's a fundamental flaw in how these AI systems are currently built.

In short: The researchers found that AI agents are easily tricked by "social engineering" disguised as technical formatting. They are so eager to follow the rules of conversation that they will happily let a stranger in the door if that stranger wears the right costume.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →