by Amit Shekhar · 3 August 2026
Prompt Injection in LLMs
Prompt Injection in Large Language Models. We will also see why it happens, how an attacker uses it, why the obvious fixes fail, and how we can defend our AI applications against it in the real world.
Read on Outcome School ↗then come back to lock it in
Before you read, guessWhat is the text sent to the model called?
Ten seconds, a guess, then read — a wrong guess still makes the answer stick.
What this article covers
- What is a Large Language Model
- What is a prompt
- The system prompt and the user prompt
- What is Prompt Injection
- The root cause of Prompt Injection
- A simple example of Prompt Injection
- Direct Prompt Injection
- Indirect Prompt Injection
- A step-by-step walkthrough of a real attack
- A code example of how the attack sneaks in
- Prompt Injection vs Jailbreaking
- Why Prompt Injection is not like SQL Injection
- What an attacker can achieve
- The defenses, one approach at a time
- Approach 1: Ask the model politely
- Approach 2: Block the bad words
- Approach 3: Mark the data clearly
- Approach 4: Put a guard in front and behind
- Approach 5: Take away the power
- Approach 6: Separate the two jobs by design
- A defense checklist
- How to test our own application
- Why this problem is still not solved
The article lives on outcomeschool.com. Read it there, then come back: the tutor in the margin has read it and will answer questions, and the questions below check what stayed.
