Prompt Injection as Role Confusion

Prompt Injection as Role Confusion

Prompt Injection is a Failure of Role Perception

Prompt injections occur because Large Language Models (LLMs) cannot reliably distinguish between different roles—such as the user, the system, or the model's own internal reasoning—based on structural tags alone. Instead, LLMs rely on "writing style" as a proxy for role identification. When an attacker mimics the style of a privileged role, the model misperceives the text as having that role's authority, leading it to execute malicious commands buried in low-privilege data.

The "Token Soup": How LLMs Process Context

To an LLM, a conversation is not a structured dialogue but a single, continuous stream of text—a "token soup." This stream contains everything: system prompts, user messages, tool outputs, and the model's own previous reasoning and responses.

To impose structure on this stream, providers use role tags (e.g., system, user, think, assistant, tool). These tags are intended to act as a type system for language, signaling how the model should process the following text:

  • User: Treat as a human request/instruction.
  • Think: Private reasoning; trust its conclusions.
  • Tool: External data; do not take orders from it.

While these tags are designed as discrete architectural boundaries, the model's internal representation of these roles is far more fluid.

Role Probes: Measuring Internal Beliefs

Researchers developed "role probes" to measure what role an LLM internally believes a token belongs to, regardless of the tag wrapping it. By training linear probes on model activations using neutral text wrapped in different tags, they created metrics like CoTness (the probability the model thinks a token is in a think block) and Userness.

Experiments revealed a critical flaw: writing style overrides structural tags.

  • Tag Removal: When role tags were stripped from a conversation, the model still assigned high CoTness to tokens that sounded like reasoning (e.g., "The user wants...").
  • Tag Conflict: When reasoning‑style text was wrapped in user tags, the model continued to perceive it as internal reasoning.

This demonstrates that LLMs identify roles via an insecure feature (style) rather than a secure one (tags). If text sounds like a specific role, the LLM treats it as that role, even if the structural tags explicitly state otherwise.

CoT Forgery: Stealing the Model's Trust

Because the think role is highly privileged—the model implicitly trusts its own reasoning conclusions—attackers can use CoT Forgery to bypass safety guardrails. By injecting fake reasoning that mimics the model's internal style (terse syntax, specific safety‑related phrasing), attackers can convince the model that it has already decided to comply with a harmful request.

In tests on frontier models, CoT Forgery increased attack success rates from near‑zero to approximately 60%. This attack is particularly robust because it does not rely on persuasion; it exploits a structural vulnerability where the model believes it is acting on its own prior conclusions.

Generalizing Role Confusion to Standard Injections

This principle extends to standard prompt injections where commands are hidden in tool outputs (e.g., a webpage). The research found that simply prepending "User: " to a command in a tool block increases the model's internal "Userness" score for those tokens, making the model more likely to execute the command. The more the model perceives the injected text as belonging to the user role, the higher the attack success rate.

The Theoretical Purpose of Roles

Roles are not merely formatting tricks; they are designed to isolate competing objectives so they can be optimized independently:

  • Think vs. Assistant: Separates messy exploration (reasoning) from clean communication (final answer).
  • User vs. Assistant: Separates comprehension (understanding the request) from generation (producing the response).
  • User vs. Tool: Separates instructions (commands to follow) from data (information to use).

Role confusion is the failure of this isolation, where competing objectives bleed together, allowing low‑privilege data to be processed as high‑privilege instructions.

Future Research and Security Implications

Subconscious Steering

Beyond dramatic jailbreaks, role confusion enables "subconscious steering." If role boundaries are soft, innocuous text (like an enthusiastic tone on a product page) could bleed into the model's persona, subtly shifting its recommendations without the user's knowledge. This presents a significant risk for AI agents handling e-commerce or financial decisions.

New Role Abstractions

To resolve objective conflicts, new roles may be necessary. For example, a dedicated Planning Role could treat plans as commitments rather than ephemeral tool data, or an Evaluation Role could provide the critical distance needed for honest self‑correction, reducing sycophancy.

Cognitive Windows

Roles provide a unique opportunity for interpretability research. Because input‑only roles (user, tool) are loss‑masked during training, their activations may provide a "clean window" into the model's comprehension, unpolluted by the generation signals present in output roles (assistant, think).

Community Perspectives

Discussion among technical practitioners highlights several critical points regarding the practical application of this theory:

"LLMs in their current form provide no security boundaries or guarantees full stop. We need to be clear about this otherwise we end up with truly insecure architectures..."

Critics argue that treating roles as a "security architecture" is a misnomer, as LLMs are fundamentally functions mapping strings to strings. Some suggest that the only viable defense is to move away from a single‑channel input stream entirely, perhaps by using separate embeddings for different roles to create an unspoofable signal that cannot be mimicked by writing style.


Prompt Injection as Role Confusion

Prompt Injection is a Failure of Role Perception

프롬프트 인젝션은 대형 언어 모델(LLM)이 구조적 태그만으로 사용자, 시스템, 모델 자체의 내부 추론 등 서로 다른 역할을 신뢰성 있게 구분하지 못하기 때문에 발생합니다. 대신 LLM은 "작성 스타일"을 역할 식별의 프록시로 사용합니다. 공격자가 권한이 높은 역할의 스타일을 모방하면, 모델은 해당 텍스트를 그 역할의 권한을 가진 것으로 오인하여 낮은 권한 데이터에 숨겨진 악의적인 명령을 실행하게 됩니다.

"Token Soup": LLM이 컨텍스트를 처리하는 방식

LLM에게 대화는 구조화된 대화가 아니라 하나의 연속적인 텍스트 흐름, 즉 "토큰 수프"입니다. 이 흐름에는 시스템 프롬프트, 사용자 메시지, 도구 출력, 그리고 모델 자체의 이전 추론 및 응답이 모두 포함됩니다.

이 흐름에 구조를 부여하기 위해 제공자는 role tags(예: system, user, think, assistant, tool)를 사용합니다. 이러한 태그는 언어에 대한 타입 시스템 역할을 하며, 모델이 다음 텍스트를 어떻게 처리해야 하는지를 신호합니다:

  • User: 인간의 요청/지시로 처리.
  • Think: 내부 추론; 결론을 신뢰.
  • Tool: 외부 데이터; 명령을 따르지 않음.

이 태그들은 이산적인 아키텍처 경계로 설계되었지만, 모델 내부에서의 역할 표현은 훨씬 유동적입니다.

Role Probes: 내부 신념 측정

연구자들은 "role probes"를 개발하여 LLM이 토큰을 어떤 역할에 속한다고 내부적으로 믿는지를 측정했습니다. 중립 텍스트를 다양한 태그로 감싸고 모델 활성화를 이용해 선형 프로브를 학습시켜 CoTness(think 블록에 속한다고 모델이 판단할 확률)와 Userness와 같은 지표를 만들었습니다.

실험 결과 중요한 결함이 드러났습니다: 작성 스타일이 구조적 태그를 무시한다.

  • Tag Removal: 대화에서 역할 태그를 제거해도 모델은 추론처럼 들리는 토큰(예: "The user wants…")에 높은 CoTness를 부여했습니다.
  • Tag Conflict: 추론 스타일 텍스트를 user 태그로 감싸면 모델은 여전히 이를 내부 추론으로 인식했습니다.

이는 LLM이 역할을 안전한 특성(태그)보다 불안전한 특성(스타일)으로 식별한다는 것을 보여줍니다. 텍스트가 특정 역할처럼 들리면, 구조적 태그가 달리 명시되어 있더라도 모델은 그 역할로 처리합니다.

CoT Forgery: 모델 신뢰 탈취

think 역할은 매우 높은 권한을 가집니다—모델은 자체 추론 결론을 암묵적으로 신뢰하기 때문입니다. 공격자는 CoT Forgery를 이용해 안전 장치를 우회할 수 있습니다. 모델의 내부 스타일(간결한 구문, 특정 안전 관련 문구)을 모방한 가짜 추론을 삽입함으로써, 모델이 이미 해로운 요청을 수행하기로 결정했다고 믿게 만들 수 있습니다.

최신 모델에 대한 테스트에서 CoT Forgery는 공격 성공률을 거의 0%에서 약 60%로 끌어올렸습니다. 이 공격은 설득에 의존하지 않고, 모델이 자체 이전 결론에 기반해 행동한다고 믿는 구조적 취약점을 이용한다는 점에서 특히 강력합니다.

일반화된 역할 혼란과 표준 인젝션

이 원리는 도구 출력(예: 웹 페이지) 안에 명령을 숨기는 일반적인 프롬프트 인젝션에도 적용됩니다. 연구에 따르면 도구 블록 내 명령 앞에 "User: "를 단순히 추가하는 것만으로도 해당 토큰들의 내부 "Userness" 점수가 상승하여 모델이 명령을 실행할 가능성이 높아집니다. 모델이 삽입된 텍스트를 사용자 역할로 인식할수록 공격 성공률이 증가합니다.

역할의 이론적 목적

역할은 단순한 포맷팅 트릭이 아니라, 경쟁 목표를 분리하여 독립적으로 최적화할 수 있게 설계되었습니다:

  • Think vs. Assistant: 복잡한 탐색(추론)과 깔끔한 커뮤니케이션(최종 답변)을 분리.
  • User vs. Assistant: 요청 이해와 응답 생성을 분리.
  • User vs. Tool: 명령(실행 지시)과 데이터(사용 정보)를 분리.

역할 혼란은 이러한 격리를 실패하게 만들어, 낮은 권한 데이터가 높은 권한 명령으로 처리되는 상황을 초래합니다.

향후 연구 및 보안 함의

무의식적 스티어링

극적인 탈옥 외에도, 역할 혼란은 "무의식적 스티어링"을 가능하게 합니다. 역할 경계가 완화되면, 제품 페이지의 열정적인 어조와 같은 무해한 텍스트가 모델의 페르소나에 스며들어 사용자 모르게 추천을 미묘하게 바꿀 수 있습니다. 이는 전자상거래나 금융 의사결정을 담당하는 AI 에이전트에 큰 위험이 됩니다.

새로운 역할 추상화

목표 충돌을 해결하기 위해 새로운 역할이 필요할 수 있습니다. 예를 들어, 전용 Planning Role은 계획을 일시적인 도구 데이터가 아니라 약속으로 취급하고, Evaluation Role은 정직한 자기 교정을 위해 비판적 거리를 제공하여 아첨 현상을 감소시킬 수 있습니다.

인지 윈도우

역할은 해석 가능성 연구에 독특한 기회를 제공합니다. 입력 전용 역할(user, tool)은 학습 중 손실이 마스킹되므로, 해당 활성화는 출력 역할(assistant, think)에서 발생하는 생성 신호에 오염되지 않은 "깨끗한 창"을 제공할 수 있습니다.

커뮤니티 관점

기술 실무자들 사이의 논의는 이 이론의 실용적 적용에 대해 몇 가지 중요한 점을 강조합니다:

"LLM은 현재 형태로는 보안 경계나 보장을 전혀 제공하지 않습니다. 이를 명확히 하지 않으면 정말로 불안전한 아키텍처가 됩니다..."

비평가들은 역할을 "보안 아키텍처"로 보는 것이 잘못된 명칭이라고 주장합니다. LLM은 근본적으로 문자열을 문자열로 매핑하는 함수이기 때문입니다. 일부는 유일한 방어책이 단일 채널 입력 스트림을 완전히 없애고, 역할마다 별도 임베딩을 사용해 작성 스타일로 모방할 수 없는 신호를 만드는 것이라고 제안합니다.


Prompt Injection as Role Confusion

Prompt Injection is a Failure of Role Perception

프롬프트 인젝션은 대형 언어 모델(LLM)이 구조적 태그만으로 사용자, 시스템, 모델 자체의 내부 추론 등 서로 다른 역할을 신뢰성 있게 구분하지 못하기 때문에 발생합니다. 대신 LLM은 "작성 스타일"을 역할 식별의 프록시로 사용합니다. 공격자가 권한이 높은 역할의 스타일을 모방하면, 모델은 해당 텍스트를 그 역할의 권한을 가진 것으로 오인하여 낮은 권한 데이터에 숨겨진 악의적인 명령을 실행하게 됩니다.


요약

Research reveals that prompt injections succeed because LLMs rely on writing style rather than structural role tags to identify instructions, allowing attackers to spoof privileged roles like internal reasoning.


제목

Prompt Injection as Role Confusion

Sources