LearnThatStack Ace your next interview
AI Security & Guardrails · question
Question 4 of 55

What is a jailbreak, and how does it differ from prompt injection?

beginner
← All AI Security & Guardrails questions
Re-explain

A jailbreak makes the model break its safety training and produce content the model would normally refuse. A prompt injection makes the model ignore the developer's instructions and follow attacker text.

Jailbreak Prompt injection
Target the model's safety policy your app's system prompt and task
Text source usually the end user, on purpose often third-party content the model reads
Typical harm disallowed or harmful output unauthorized tool calls, data leakage
Fix owner mostly the model provider mostly you, the application team

A jailbreak example: a user wraps a request for weapon instructions in a role-play story. A prompt injection example: a web page tells a browsing assistant to email the user's files to an outside address.

Jailbreaks are largely a content-policy problem. Injection is an application security problem: least privilege, scoped tools, and no blind trust in model output.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

The diagram below the answer is the concept . Jump to it ↓

Tailored explanation · switch back to · ·
What should the new diagram focus on?
Guided practice for AI Security & Guardrails One question at a time. Answer out loud, get graded, see what you missed.
How well did you know this?
AI:

Saved in this browser - sign in to keep your review list.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Interview lens How interviewers actually use this question

Likely follow-ups

  • Can a single attack be both a jailbreak and a prompt injection? Give an example. Yes. A planted document can carry jailbreak text too. Say which rule each part breaks, and whether the harm is bad output or a bad action.
  • Why can't prompt injection be fixed the way parameterized queries fixed SQL injection? Instructions and data share one token stream. The model has no enforced separation between them, so there is nothing to escape.
  • Why won't the model's safety training stop most prompt injections? Training is probabilistic and aimed at harmful content. An injected 'email these files' looks like a normal request and breaks no content rule.
  • How does least privilege limit the damage when an injection succeeds? Give the agent only the tools and data the task needs, scope credentials to the user, and gate risky actions like sending data out.
  • Jailbreaks are mostly the provider's problem. What can your team still do about them? Moderate inputs and outputs, add a guardrail classifier, watch for abuse per account, and accept that some attempts will still get through.

What you can say

  1. A jailbreak gets the model to break its safety training and produce content it would normally refuse.
  2. Prompt injection is different. It makes the model ignore the developer's instructions and follow text an attacker planted.
  3. The source is different too. A jailbreak usually comes from the end user on purpose, like wrapping a request for weapon instructions in a role-play story.
  4. Injection often comes from third-party content the model reads, like a web page telling a browsing assistant to email the user's files to an outside address.
  5. So the harm differs. A jailbreak typically produces disallowed output, while an injection leads to unauthorized tool calls and data leakage.
  6. Fixes split the same way. Jailbreaks are mostly on the model provider, but injection is on my team, through least privilege, scoped tools and treating model output as untrusted.

Weak answers to avoid

  • Treats jailbreak and injection as the same thing Both use crafted text, but they break different rules. Say which one each overrides, the model's safety policy or your app's instructions.
  • Says safety training or a better model fixes injection Injected text often asks for something harmless-looking, like sending an email. Injection is your app's problem: least privilege, scoped tools, untrusted output.
  • Assumes the attacker is always the user typing Injection often arrives inside content the model reads, like a web page or email. Missing it means missing the path to tool misuse and data leaks.
Interview lens

Likely follow-ups, what you can say, and the weak answers to avoid.

Sign in free to open it Free account - the lens opens as soon as you're back.

Want a quick review of the fundamentals? See the AI Security & Guardrails cheatsheet.

← Back to all AI Security & Guardrails questions
Pro · $10/mo

48 of 55 AI Security & Guardrails answers are in Pro.

Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.

  • Full answers + code
  • AI explanations, simpler or deeper
  • 1,000 AI credits / month
  • Cancel anytime