Safety, Security & Responsible AI·Question 10 of 70Basic

Explain the confused deputy problem, and why an LLM agent is close to a worst case for it.

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

A confused deputy is a privileged program tricked by a less-privileged party into misusing its authority on that party's behalf. The classic 1988 example is a compiler with write access to a billing file: a user cannot write that file, but can ask the compiler to write its output there, and the compiler happily uses its own authority to do it. The deputy is not compromised, it is confused about whose request it is serving.

Full worked answer with diagram

A confused deputy is a privileged program tricked by a less-privileged party into misusing its authority on that party's behalf. The classic 1988 example is a compiler with write access to a billing file: a user cannot write that file, but can ask the compiler to write its output there, and the compiler happily uses its own authority to do it. The deputy is not compromised, it is confused about whose request it is serving.

An LLM agent is nearly the perfect confused deputy. It holds the user's authority (their OAuth tokens, their database session, their mailbox), it accepts instructions in natural language, and its context window has no privilege separation: the user's request, a retrieved web page, and a tool result are all just tokens. So any attacker who can get text into that context is issuing requests that the agent will execute with the user's authority. The attacker never needs credentials. They borrow yours.

The distinction from plain prompt injection is worth making in an interview. Injection describes the mechanism (text steers the model). Confused deputy describes the authority failure (the model's actions carry privileges the text's author does not have). Framing it as a confused deputy is more useful, because it points straight at the fix: the problem is not the text, it is that authority is ambient.

The defences follow classic capability-security thinking. Do not let the model decide what it is authorised to do; enforce authorisation at the tool boundary, server-side, against the identity of the human principal for this request. Scope tokens per session and per task rather than handing over a standing service account. Carry provenance so the system knows which parts of the context are untrusted. And gate sinks (send, pay, delete) on the effect, computed outside the model.

The same pattern shows up in OAuth flows for MCP clients, where a shared client identity plus a pre-consented redirect lets an attacker inherit a user's grant.

Worth sketching. The attacker never touches the CRM, and a sequence makes that obvious: the authority on that arrow is the user's.

sequenceDiagram
    participant Attacker
    participant Webpage
    participant Agent
    participant CRM
    Attacker->>Webpage: plants instruction-shaped text
    Agent->>Webpage: fetches it mid-task
    Webpage->>Agent: text arrives as just more tokens
    Agent->>CRM: query signed with the user's token
    CRM->>Agent: records, correctly authorised
    Agent->>Attacker: data leaves the boundary

What a good answer covers

  • A confused deputy is a privileged program tricked by a less-privileged party into misusing its authority…
  • The classic 1988 example is a compiler with write access to a billing file
  • The deputy is not compromised, it is confused about whose request it is serving
  • An LLM agent is nearly the perfect confused deputy
  • It holds the user's authority (their OAuth tokens, their database session, their mailbox), it accepts…

Interviewer follow-ups to expect

  1. How does the confused deputy framing change your design compared to just calling it prompt injection?

  2. What would ambient authority look like in a concrete agent you have built, and how would you remove it?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep