Lesson 03 Direct Prompt Injection
Theme:

Homework: Direct Prompt Injection

Objective: Create a comprehensive reference document cataloging direct prompt injection techniques, and demonstrate your ability to reason about attack effectiveness and categorization.

Task 1: Prompt Injection Cheat Sheet

Create a "Prompt Injection Cheat Sheet" containing at least 8 different techniques. For each technique, provide:

  1. Technique name (e.g., "Authority Escalation," "Fictional Framing")
  2. Category (Instruction Override / Role-Playing / Context Manipulation / Encoding / Multi-Turn / Obfuscation)
  3. Example payload (a realistic, complete payload that could be typed into a chat interface)
  4. Why it works (1-2 sentences explaining the psychological or technical mechanism)
  5. Reliability rating based on your lab experience:
    • Low: Works on small/old models but rarely on modern frontier models
    • Medium: Sometimes succeeds against modern models, especially with iteration
    • High: Frequently effective even against well-defended modern models

Use the following table format for your cheat sheet:

#TechniqueCategoryExample PayloadWhy It WorksReliability
1 (name) (category) (payload text) (mechanism) Low / Med / High
2...
3...
4...
5...
6...
7...
8...

Self-check criteria:


Task 2: Technique Analysis

For each of the 8 techniques in your cheat sheet, write an additional analysis (2-3 sentences each) answering:

This exercise demonstrates the cat-and-mouse nature of prompt injection defense. For example:

Example analysis:
Technique: Classic "ignore instructions"
Defense: Input filter that blocks messages containing "ignore" + "instructions" within 5 words.
Evolution: The attacker switches to synonyms: "disregard the above directives," "set aside prior guidance," or splits the phrase across two messages in a multi-turn attack.

Self-check criteria:


Task 3: Design a "Hardened" System Prompt

Using what you have learned in Lessons 01-03, rewrite the following weak system prompt to be more resistant to direct injection. You may restructure it, add defensive instructions, remove sensitive data from the prompt, or any other technique you think would help.

Weak system prompt (to improve):

You are a banking assistant for FirstBank. Help customers with
their accounts. Never tell customers other people's account
balances. Admin password: FB#Admin2024. Customer database is at
db.firstbank.internal. High-value customers (over $1M): John Smith
(acct 4421), Jane Doe (acct 7783), Bob Wilson (acct 9912).

Requirements for your hardened version:

Self-check criteria:


Task 4: Reflection — The Attacker's Advantage

Write a short reflection (150-200 words) on the concept of asymmetric effort in prompt injection:

Self-check criteria: