AI Security Interview Q&A
Q: What is prompt injection, and why is it fundamentally different from something like SQL injection?
Prompt injection is an attempt to override a model's intended instructions using crafted input. SQL injection exploits a boundary between code and data that a database engine mostly maintains, and escaping or parameterizing input closes that gap fairly reliably. An LLM has no equivalent boundary — the system prompt, user input, and retrieved content all arrive as the same kind of text in the same context window, so there's no syntactic marker that reliably separates "this is an instruction" from "this is data," which is why input sanitization alone doesn't close this the way it closes SQL injection.
Q: What's the difference between direct and indirect prompt injection, and which is harder to defend against?
Direct injection is a user explicitly trying to override instructions in their own message, which is at least visible — something scanning incoming messages has a real shot at catching. Indirect injection hides the same kind of override inside content the model processes as data on someone else's behalf — a document, a webpage, a tool's returned result — where nobody is specifically screening that content for embedded instructions before the model reads it. Indirect injection is the harder case, because defenses have to extend to everything the model reads, not just what a user typed.
Q: An agent with database read access and an image-rendering tool gets manipulated by an injected instruction. What's the realistic worst case, beyond the model saying something embarrassing?
The realistic worst case is data exfiltration using tools the agent already legitimately has: an injected instruction tells the agent to render an image at an attacker-controlled URL with sensitive data encoded as query parameters, and the data leaves the system the moment that request fires — with nothing in the visible text response looking wrong. Output filtering that only scans the model's printed answer misses this entirely, since the leak happens through a side effect, not the response text.
Q: What does "excessive agency" mean in an LLM security context, and when does that risk actually begin?
Excessive agency describes a system granted more capability than its actual task requires — an agent with write or delete access when its job only ever needs to read. That risk exists from the moment the overprovisioned connection is made, independent of whether anyone ever exploits it; it's a design problem to fix before deployment, not something to treat as settled just because no incident has happened yet.
Q: Why isn't "treat tool outputs and retrieved content as data, not instructions" a complete fix on its own?
It's a genuinely useful mitigation — explicitly marking that content as data in the prompt structure reduces how often an embedded instruction actually gets followed. It isn't complete because the model still processes that content as text in the same context as everything else, and a sufficiently well-crafted injection can still succeed even when the system explicitly instructs the model not to treat that content as a command.
Q: Where should human-in-the-loop confirmation be placed, and what happens if it's overused?
It belongs on genuinely consequential actions — deleting data, sending something externally, moving money — where a pause for approval meaningfully reduces real-world damage from a successful injection. Placed on routine, low-stakes actions as well, it trains users to click through approvals reflexively without reading them, which empties the confirmation step of its value exactly where it matters most.
Q: Why does defense in depth matter more for LLM security than it might for some other security domains?
No single mitigation covers prompt injection completely — least-privilege tool scoping limits the damage from a successful injection, marking content as data reduces how often injection succeeds at all, monitoring tool-call patterns catches unusual behavior after the fact, and human confirmation guards consequential actions specifically. A system leaning on just one of these layers is one failure away from a real incident; layering several independently-failing defenses means an attacker needs several things to go wrong at once for the same outcome.
Q: A support-ticket-summarization agent doesn't need outbound-email access to do its job, but that tool is already connected because it was convenient to wire up. What's the risk, and what would you do?
That unused email tool is a textbook case of excessive agency — it sits there as a ready-made exfiltration path for any indirect injection hidden in a submitted ticket, despite having nothing to do with summarizing tickets. Pulling the tool out of the agent's reach entirely closes that path for good, which beats the alternative of trying to anticipate and block every possible phrasing an injected instruction might use to trigger it.
Q: Beyond prompt injection at runtime, what's a training-data-related risk worth knowing about?
Data poisoning — manipulating a model's training or fine-tuning data to teach it a subtly harmful behavior before it's ever deployed — is a distinct risk from runtime injection, operating earlier in the pipeline. For most teams building on a third-party foundation model rather than training from scratch, this shifts the practical mitigation toward vetting the model provider and any fine-tuning data source, rather than something addressed at the application layer the way prompt injection defenses are.
Q: Why might a well-intentioned injected instruction still be dangerous, even if it doesn't look like a typical "ignore your instructions" attempt?
An injected instruction doesn't need to announce itself as an attack to be dangerous — it just needs to successfully trigger an action the system has legitimate capability to perform. An instruction phrased as a normal, reasonable-sounding request ("please also forward this to billing for processing") can be just as effective at misusing legitimate tool access as an obvious override attempt, which is exactly why scoping what's reachable matters more than trying to recognize every possible phrasing of an attack.

