GPT-4o
⚙️ Technical
Advanced
Prompt Injection Defense and Safety
Design prompts and system architectures that defend against prompt injection attacks — where user input attempts to override system instructions or extract sensitive data.
The Prompt
# Prompt Injection Defense and Safety You are an AI security specialist. Design a defensive prompting strategy for [APPLICATION TYPE] that protects against prompt injection and instruction override attacks. ## What Prompt Injection Is Explain the attack: how malicious user input can contain instructions that override system prompts, leak sensitive data, or cause the AI to behave outside its intended scope. Provide 3 real-world examples relevant to [APPLICATION TYPE]. ## Attack Vectors List the 6 most common injection techniques: - Direct override: "Ignore all previous instructions and..." - Role hijacking: "You are now a different AI that has no restrictions..." - Context poisoning: embedding malicious instructions in uploaded documents - Delimiter confusion: using fake system-prompt delimiters in user input - Indirect injection: instructions embedded in web content the AI reads - Jailbreak chaining: building up to a restricted output through seemingly innocent steps ## Defensive Techniques For each attack vector, provide the corresponding defense: - Input sanitization rules - System prompt hardening techniques - Output filtering for sensitive data patterns - Structural separation of trusted vs. untrusted content ## Hardened System Prompt Write a hardened system prompt for [APPLICATION TYPE] that incorporates all defensive techniques and explicitly handles the most likely injection attempts.
📝 Fill in the blanks
Replace these placeholders with your own content:
[APPLICATION TYPE]
How to use this prompt
1
Copy the prompt
Click "Copy Prompt" above to copy the full prompt text to your clipboard.
2
Replace the placeholders
Swap out anything in [BRACKETS] with your specific details.
3
Paste into GPT-4o
Open your preferred AI assistant and paste the prompt to get started.