OWASP Cheat Sheet: LLM Prompt Injection Prevention Cheat Sheet / GUIDANCE
LLM Prompt Injection Prevention Cheat Sheet
Prompt injection is a vulnerability in Large Language Model (LLM) applications that allows attackers to manipulate the model's behavior by injecting malicious input that changes its intended output. Unlike traditional injection attacks, prompt injection exploits the common design of most LLMs where natural language instructions and data are processed together without clear separation. Key impacts include: - Bypassing safety controls and content filters - Unauthorized data access and exfiltration - System prompt leakage revealing internal configurations - Unauthorized actions via connected tools and APIs - Persistent manipulation across sessions
- Category
- OWASP LLM / GenAI
- Version / scope
- OWASP Cheat Sheet Series; commit 7af0ef1b745f1a38ce905c00c5a592d5b3a515a9
- Affected / relevant technologies
- LLM applications / Agent integrations
- Evidence
- Documentation: pinned-source excerpt checked. Execution: not tested. Editorial: curated reference.
Defensive analysis and explicitly authorized assessment only. This website performs no scans, exploitation, model calls or infrastructure changes. Indicators below are investigation opportunities, not proof of compromise or guaranteed detectors.
Mechanism and prerequisites
Match the design and deployment assumptions in the cited revision. Use authorized review evidence; do not send production secrets to test systems.
Potential impact
This is preventive engineering guidance, not a new Top 10 risk, a CVE or proof of an exploitable deployment.
Versioned source scope
This record contains normalized, sometimes shortened source excerpts with editorial safety context. Markup and executable example blocks are omitted. Source-field verification does not establish device testing, a working detector or local applicability.
Publisher: OWASP. Release: OWASP Cheat Sheet Series; commit 7af0ef1b745f1a38ce905c00c5a592d5b3a515a9. Source checked: 2026-11-18.
Source object: OWASP Cheat Sheet: LLM Prompt Injection Prevention Cheat Sheet.
Attribution and source terms (OWASP contributors · CC BY-SA 4.0)Detection and investigation
- Publisher review topics: Primary Defenses; Input Validation and Sanitization; Output Monitoring and Validation; Best-of-N Attack Mitigation; Additional Defenses; Agent-Specific Defenses; Comprehensive Monitoring; Secure Implementation Pipeline
Preserve source timestamps, asset identity and collection context. Correlate independent evidence before attributing malicious intent. In OT, review passive evidence with the process owner; do not induce failures, replay commands or write to controllers to test a hypothesis.
Mitigation and response
- Input screening can flag known attack phrasing for logging, review, or rate limiting. It is not a security boundary: LLMs do not enforce a boundary between instructions and data in a prompt, and an attacker can rephrase an instruction in many ways that a deny list does not match (NCSC). The OWASP LLM01 guidance lists string checks and semantic filters as one mitigation, and describes attackers who use other languages or encodings such as Base64 to evade filters. Keyword and fuzzy-matching filters make two kinds of errors: - False positives. Single words such as delete, system, or reveal appear in ordinary requests, for example "How do I delete my account?" or "What are the system requirements?". Flagging them blocks legitimate users. Match phrases rather than single words, and measure the false-positive rate on benign requests from your application (see Smoke-Testing Your Defenses). - Missed injections. Paraphrases ("Disregard prior directions"), other languages, and encoded payloads contain none of the listed patterns. String metrics such as Damerau-Levenshtein distance catch some misspellings, but similarity does not identify intent. Normalize text before screening it, and know […]
- Monitor LLM outputs for signs of successful injection attacks.
Apply changes through the asset owner's approved change and recovery process. Documentation review is separate from successful testing or verified production protection.
Related technical context
No protocol-specific mapping is asserted for this entry.
Related security reading
Continue directly to another reference. Editorial reading connections do not assert official CWE/CAPEC/ATT&CK/OWASP equivalence or mappings.
Authoritative sources and attribution
Identifiers and source titles belong to OWASP, MITRE, the CVE Program, CISA, NIST or the cited vendor. Source excerpts are attributed and adapted under the linked publisher license; editorial context is separate. This is not an official framework mirror. Review baseline: 2026-11-18. Live documents can change; check exact current applicability.
- Publisher reference: OWASP Cheat Sheet: LLM Prompt Injection Prevention Cheat Sheet — source accessed 2026-11-18
- cheatsheets/LLM_Prompt_Injection_Prevention_Cheat_Sheet.md — source accessed 2026-11-18
Source review supports bounded reference text. It is not execution evidence, a completeness claim, a CVSS assessment, a compliance certification or verification of production security.
