An LLM prompt is the input text, including instructions, context and user data, that is sent to a large language model to generate a response. Attackers craft prompts for injection or jailbreaking, or to extract system instructions and data. Defenders treat untrusted input as hostile, filter and log prompts and outputs, and keep secrets out of prompts.
How LLM Prompts Work
An LLM prompt is the control surface for model behaviour: it combines instructions, context, and supplied data into the request the model interprets. The same mechanism that makes prompts useful for steering output also makes them a security boundary, because adversarial or careless prompt content can change what the model reveals, how it reasons, or which tools it reaches.
Prompts are not just short user questions. In practical systems they may include system instructions, conversation state, retrieved documents, policy text, formatting constraints, and embedded secrets or identifiers. That breadth is why prompt design, prompt handling, and prompt hygiene matter even before any attack is considered.
In enterprise AI, the prompt often becomes a carrier for business context and sensitive data. If that context is copied from logs, tickets, documents, or upstream applications without filtering, the prompt can inherit the same confidentiality, integrity, and compliance risks as the source material.
Why Prompt Injection and Jailbreaking Matter
Prompt injection and jailbreaking are attempts to override intended instructions, steer the model away from policy, or coerce it into revealing hidden context. The danger is not limited to harmless misbehaviour; a successful attack can expose system prompts, retrieved data, connector content, or downstream tool actions that the application assumed were protected.
These failures are especially serious when the model sits inside a workflow that can search documents, call APIs, or write back to other systems. A crafted prompt may not need to break the model directly; it only needs to confuse the application into treating untrusted text as higher-priority instructions than the system’s own policy.
Secrets, Data, and Trust Boundaries in Prompts
Prompts should be treated as hostile input whenever they come from a user, an external source, or an upstream system that has not been fully trusted. That means the safest design is to keep secrets out of prompts wherever possible, minimise sensitive context, and separate control instructions from data fields so the model cannot confuse the two.
Prompt data also deserves logging discipline. Logs are useful for debugging and abuse analysis, but they can become a second copy of the same sensitive information if raw prompts and outputs are retained without redaction, access control, or retention limits. For organisations building retrieval-augmented or tool-using systems, that boundary is as important as the model itself.
For practical guidance on hardening prompt pipelines, NHI Management Group’s Input Validation and Output Encoding Guide is useful because prompt handling follows the same defensive logic as other untrusted input paths.
Prompt Handling Across the AI Stack
Prompt risk is not confined to chat interfaces. It also appears in templates, system prompts, retrieval contexts, agent instructions, evaluation prompts, and integration layers that assemble model input from multiple sources. Each layer can introduce ambiguity, leakage, or injection opportunities if it is not explicitly designed around trust boundaries.
That is why prompt security is usually paired with output filtering, context isolation, and monitoring. Teams should expect prompt behaviour to change as model versions, toolchains, and retrieval sources change, then test those changes as part of the application lifecycle rather than assuming the old prompt remains safe.
Prompt engineering is therefore not only a product feature, it is an operational control. The question is not whether the model can answer the prompt, but whether the prompt structure preserves the right separation between instructions, data, and privileged context.
Risk and Threat Considerations
Prompt-based attacks matter because they can turn ordinary text input into an execution path for policy bypass, data exfiltration, and unsafe tool use. The most damaging failures happen when a model is allowed to treat attacker-controlled content as instructions, or when hidden context contains secrets that should never be exposed to the model in the first place.
Failure mechanism: Injection succeeds when untrusted text is merged into instruction space, or when the application fails to isolate retrieved content, system prompts, and tool instructions from user-supplied data. That can lead to disclosure of hidden prompts, sensitive retrieval results, or unintended actions in connected systems.
Impact: The result can be confidentiality loss, integrity loss, and in some architectures, downstream compromise through abused tool access, leaked credentials, or corrupted outputs that other systems trust.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP API Security Top 10 and MITRE ATT&CK address the attack and risk surface, while OWASP ASVS, NIST SP 800-53 Rev 5 and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP ASVS | V1 — Encoding and Sanitization | Prompts are untrusted input that must be validated and encoded safely. |
| Recommendation — Apply V1 rules to validate prompt fields and encode untrusted text before it reaches model-facing sinks. | ||
| NIST SP 800-53 Rev 5 | IA-5 — Authenticator Management | Prompt workflows must keep secrets and credentials out of text paths that may be logged or exposed. |
| Recommendation — Protect and rotate credentials so they never need to appear in prompts or prompt logs. | ||
| OWASP API Security Top 10 | API8 — Security Misconfiguration | LLM prompt handling often fails through unsafe configuration of instruction, retrieval, and logging boundaries. |
| Recommendation — Harden prompt-processing configurations to prevent instruction leakage and unsafe context exposure. | ||
| MITRE ATT&CK | T1565 — Data Manipulation | Prompt injection alters model instructions and can manipulate downstream outputs or actions. |
| Recommendation — Detect manipulated prompt content and validate model outputs before downstream use. | ||
| NIST CSF 2.0 | PR.DS-01 — Data-at-rest is protected | Prompt logs and stored context require confidentiality controls because they may contain sensitive data. |
| Recommendation — Protect stored prompts and outputs with confidentiality controls and restricted retention. | ||
Practitioner Guidance
Why practitioners should care: Prompt security is a design and operations issue, not just a model-tuning issue. If the application ingests untrusted text, blends it with privileged instructions, or logs it carelessly, then the prompt becomes part of the attack surface and the data-handling surface at the same time.
Common misunderstanding: Many teams assume “the model will ignore bad instructions” or that a system prompt alone is enough protection. In reality, secure prompt handling depends on clear instruction hierarchy, data separation, and a refusal to place secrets or high-value context into text the model can surface or reuse.
Practitioner takeaway: Treat prompts like any other security-sensitive input channel, because once the model can see it, reason over it, and log it, the prompt has effectively become part of the control plane.
Related resources from NHI Mgmt Group
- What is the difference between prompt injection and LLM remote code execution?
- How should security teams handle prompt injection in production LLM applications?
- What breaks when authorization happens inside the LLM prompt instead of the workflow?
- Why do prompt templates create security risk in LLM deployments?
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on November 26, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org