This article describes a role-confusion injection attack where user input can forge system-level instructions in AI systems that build prompts through plain-text concatenation of role markers. The SupportBot lab demonstrates how attackers can impersonate the SYSTEM role to extract protected information by inserting fake SYSTEM directives into their messages. The vulnerability exists because textual role boundaries offer no real separation, allowing the model to treat forged instructions with the same authority as genuine system directives.
- How the attack exploits text-based role markersWhen a system concatenates SYSTEM, USER, and ASSISTANT turns as plain text with literal role markers (like 'SYSTEM:' or 'USER:'), an attacker can include those same markers within their user message. Once concatenated into the final prompt, the forged marker appears indistinguishable from authentic role delimiters, causing the model to execute instructions that look like legitimate system directives with elevated privileges.
- Why plain-text boundaries fail fundamentallyThe core vulnerability is that role boundaries created only through text markers are not actual boundaries—they are content the attacker can also write. The model cannot differentiate a forged SYSTEM line from a genuine one once both exist in the same concatenated string, so it grants the attacker's text the same authority as real system instructions.
- Practical exploitation steps in the labThe attack involves three steps: first, confirming the prompt uses plain-text role markers that can be reproduced; second, placing a forged system-role instruction within the user message (for example, to disclose an admin-only staff PIN); third, submitting the message and observing whether the model executes the forged instruction as if it came from the system role. The concatenation process makes the fake directive indistinguishable from real ones.
- Structured chat APIs eliminate the vulnerabilityThe primary defense is using the provider's structured chat API, which enforces role boundaries outside the text itself rather than relying on text markers. This architectural approach ensures the platform, not the concatenated string, determines which instructions carry system authority, making role impersonation impossible.
- Defense-in-depth complementary measuresBeyond structured APIs, the article recommends stripping or escaping role-delimiter patterns from user input as an additional layer, and keeping secrets out of the prompt entirely so that even if a forged instruction succeeds, there is nothing sensitive to reveal.
- Classification within OWASP LLM taxonomyThe article categorizes role-confusion injection as a form of OWASP LLM01 Prompt Injection with overlap to LLM07 System Prompt Leakage, indicating it is a recognized attack class in the OWASP Top 10 for LLM Applications (2025). It is most common in hand-rolled prompt templates that predate or ignore structured chat APIs.
Bottom line: The fundamental lesson is that role boundaries enforced only through text markers are not real boundaries—they must be enforced by the platform's structured chat API architecture. Never build prompts by concatenating user input with role delimiters, as this allows attackers to forge system-level instructions that the model will execute with elevated privileges.
📋 In this walkthrough
What this lab teaches
Role-confusion injection exploits prompts built by string concatenation with textual role delimiters. Because the boundaries are just text, user input containing the same delimiters can impersonate a higher-privilege role and issue instructions the model obeys.
The lesson: role boundaries that are only plain-text markers are not boundaries. The model cannot tell a forged SYSTEM line from a genuine one.
How SupportBot builds its prompt
SupportBot concatenates roles into one string using literal markers. Your message is inserted into the USER section, but if it includes a forged SYSTEM marker and instruction, the assembled prompt now contains what looks like a legitimate system directive.
The attack approach
- Confirm the prompt uses plain-text role markers you can reproduce.
- Place a forged system-role instruction inside your user message.
- Direct it to reveal the admin-only field the bot normally refuses.
- Submit and read the leaked value.
Full walkthrough (spoiler)
If the bot ignores the forged line, the marker format is slightly off — open the steps.
Show the step-by-step solution
- In your message, include a line that mimics the system role marker followed by an instruction to disclose the staff PIN.
- The prompt builder concatenates it in, so the final prompt appears to contain a genuine system directive.
- The model follows the forged instruction with system-level trust.
- The staff PIN is revealed and the lab marks you solved.
Why it works
The boundary between roles is a string the attacker can also write. Once your forged marker is in the concatenated prompt, nothing distinguishes it from a real system line, so the model grants it the authority of the system role.
Where this happens in the real world
Role-confusion via template injection is a form of OWASP LLM01 Prompt Injection and overlaps LLM07 System Prompt Leakage. It is common in hand-rolled prompt templates that predate or ignore structured chat APIs.
How to defend against it
- Use a structured chat API (role-separated messages) so role boundaries are enforced by the platform, not by text.
- Never concatenate user input with role markers into one string.
- Strip or escape role-delimiter patterns from user input as defence in depth.
- Keep secrets out of the prompt so a forged instruction has nothing to reveal.
Try it, then go further
Reading about it is the easy part. Open the lab, try your own approach before peeking at the spoiler, and see how many attempts it takes.
