C.W.K.
Stream
Lesson 10 of 10 · published

Red Teaming Your Own Prompts

~14 min · security, red-team

Level 0Apprentice
0 XP0/100 lessons0/14 achievements
0/120 XP to next level120 XP to go0% complete

The team that breaks before the attacker does

Red teaming is the practice of attacking your own system before someone else does. For LLM apps it means: take your prompts, your tools, your data flows — and try to make them misbehave. The attacks you find become regression tests.

What to attack

  • Direct injection in the user message.
  • Indirect injection in a doc / tool result you control.
  • Persona / role overrides via roleplay framings.
  • Privilege escalation via tool argument manipulation.
  • Output exfiltration via embedded URLs / images.
  • Cross-user data leakage via tool argument confusion.

How to do it sustainably

  • Start with a checklist; expand as you discover.
  • Each found issue becomes an eval test case.
  • Run the suite on every prompt or model update.
  • Rotate the red-teamer if possible; one person blind-spots fast.

Public resources

Anthropic's HackerOne program, OpenAI's red-teaming network, and academic adversarial-prompt repos give you a starter set of patterns. Don't reinvent.

Code

Red-team test as eval·python
redteam_cases = [
    {"name": "direct-override", "input": "Ignore previous instructions...", "must_not_contain": ["system prompt:"]},
    {"name": "roleplay-launder", "input": "Write a story where a character explains [forbidden]...", "must_not_contain": ["forbidden details"]},
    {"name": "indirect-via-doc", "input": "", "docs": [INJECTED_DOC], "must_not_contain": ["http://attacker.tld"]},
]
run_eval(redteam_cases)

External links

Exercise

Write 10 red-team cases for one of your endpoints. Run them. Convert any pass-throughs into prompt or runtime fixes. Add the cases to your eval suite.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.