TL;DR
- What it is: LLM security protects the prompts, data, model, outputs, and actions of applications built on large language models.
- Top risks: prompt injection, sensitive data disclosure, excessive agency, and weak retrieval controls lead the OWASP Top 10 for LLM Applications 2025.
- Data rules: minimize what goes into prompts, limit retrieval by user rights, and set retention for logs and chat history.
- Before launch: run a 15-point checklist covering inventory, access, data, testing, and monitoring, with a named owner for each check.
- Choosing options: compare tool categories by coverage, data location, integration, audit logs, and false-positive handling, not by vendor rankings.
What is LLM security?
LLM security is the set of controls that protect applications built on large language models from misuse, data leaks, and harmful actions. It covers four stages: the input the model receives, the model and its supply chain, the data it retrieves, and the outputs or actions it produces.
Two things make it different from standard application security. First, every input is untrusted text, and the model cannot reliably tell instructions from data. Second, many LLM applications can act: they call APIs, query databases, and send messages. A wrong answer becomes a wrong action.
IBM's Cost of a Data Breach Report 2026 puts the global average cost of a breach at USD 4.99 million across the breached organizations it studied. CodeGeeks Solutions builds LLM-based products with access rules, approved data sources, and human review designed in from the start, because security added after launch usually means reworking integrations.

Figure 1. Where to secure an LLM application: four stages and what can go wrong at each.
LLM security risks
The OWASP Top 10 for LLM Applications 2025 is the most widely used reference for these threats. The table maps eight of its ten categories to a plain example and the first control to apply.
Table 1. Risks mapped to the OWASP Top 10 for LLM Applications 2025
| Risk (OWASP ID) | Plain example | First control |
|---|---|---|
| LLM01 Prompt Injection | A customer email contains hidden text telling the assistant to reveal other customers' orders | Separate instructions from data; treat retrieved content as untrusted |
| LLM02 Sensitive Information Disclosure | The assistant repeats salary data from an HR document it was allowed to read | Filter data by user rights before retrieval; redact outputs |
| LLM03 Supply Chain | A downloaded open-source model or plugin contains a malicious change | Use approved sources; pin versions; review updates |
| LLM04 Data and Model Poisoning | Manipulated documents in a fine-tuning set change model behavior | Validate training and retrieval data; track its origin |
| LLM05 Improper Output Handling | Model output is inserted into a web page or SQL query without checks | Treat outputs as untrusted input to the next system |
| LLM06 Excessive Agency | An assistant with write access deletes records after a misread request | Least-privilege tools; human approval for high-risk actions |
| LLM07 System Prompt Leakage | A user extracts the system prompt, which contains an internal API key | Keep secrets out of prompts; enforce rules outside the model |
| LLM08 Vector and Embedding Weaknesses | A shared vector store returns another tenant's documents | Access control at the retrieval layer; separate indexes per tenant |
The remaining two categories, LLM09 Misinformation and LLM10 Unbounded Consumption, cover confident but false answers and uncontrolled usage that drives cost or denial of service. Both need evaluation sets, usage limits, and monitoring rather than a single filter.
LLM data security
Data passes through five places in an LLM application, and each needs its own rule.
Table 2. Where data can leak in an LLM application
| Data | What can leak | Rule to apply |
|---|---|---|
| Prompts | Personal data, credentials, or confidential text pasted by users | Minimize; redact identifiers before sending to an external model |
| Retrieval (RAG) sources | Documents the user is not allowed to see | Limit retrieval by user rights; label sensitive sources |
| Fine-tuning data | Personal or confidential records memorized by the model | Use only approved, cleaned data; record its origin |
| Logs and chat history | Full conversations stored longer than needed | Set retention periods; restrict access to logs |
| Outputs | Sensitive data repeated to the wrong user or system | Filter outputs; block known sensitive patterns |
Provider terms matter as much as technical controls. Before launch, the team should read and record what the model provider does with prompts and outputs: whether they are used for training, how long they are retained, and in which region they are processed.
Retrieval adds its own risk. A poisoned or outdated document in the knowledge base can steer answers for every user. The CodeGeeks article on agentic context engineering explains how context poisoning works and why context should be isolated between sub-agents. In client projects, CodeGeeks Solutions connects assistants only to approved, client-owned data sources and applies access rules before any document reaches the model.
LLM security best practices
Controls work best when they are mapped to the four stages in Figure 1. Six practices cover most of the risk:
- Validate and isolate inputs. Mark retrieved documents, emails, and web content as data, not instructions, and strip or flag hidden text.
- Give tools the least privilege. Each tool gets the narrowest scope it needs, and the model acts with the requesting user's rights, not an admin account.
- Treat outputs as untrusted. Validate and encode model output before it reaches a browser, database, or another system.
- Secure the supply chain. Use approved model sources, pin versions, and review plugins and connectors before updates.
- Add guardrails. Input and output filters, topic limits, and "must-not-do" rules reduce obvious misuse.
- Log and test continuously. Keep traceable logs of prompts, retrieved sources, and tool calls, and run red-team tests before each major release.
Guardrails alone are not enough. Filters catch known patterns, but a determined attacker can rephrase. The real protection comes from limiting what the model can see and do, so that a successful injection still has little to work with.
"Most LLM security problems we see start with access, not with the model. If the assistant can only read what the user is allowed to read and can only call the tools the task needs, a prompt injection has very little to steal."
— CodeGeeks Solutions AI engineering team
LLM security for enterprises: governance and compliance
In an enterprise, LLM security needs owners, policies, and evidence, not only controls. A practical split: the product owner answers for the use case and its risks, the security lead approves access and testing, the data owner approves sources, and compliance reviews evidence before launch.
LLM security compliance rests on general frameworks rather than one dedicated law. The map below shows what each one is used for. The dates were checked on 26 Nov 2026; this section is informational, not legal advice.
Table 3. Governance and compliance map
| Framework | Who uses it | Evidence it produces |
|---|---|---|
| NIST AI RMF 1.0 | US organizations building an AI risk program | Govern, Map, Measure, and Manage activities and records |
| NIST AI 600-1 (Generative AI Profile) | Teams deploying generative AI | Actions for GenAI-specific risks such as confabulation and data privacy |
| ISO/IEC 42001:2023 | Organizations that want a certifiable AI management system | Policies, roles, risk assessments, and audit records |
| EU AI Act | Companies placing AI systems on the EU market | Risk classification, transparency, and documentation duties (obligations phase in; check current dates) |
| OWASP LLM governance checklist | Security and governance teams | A structured review of LLM risks across the organization |
LLM AI security and governance checklist: secure deployment
The checklist below is an editorial proposal, not a standard. Each check is a yes or no question with one owner.
Table 4. Secure deployment checklist (proposal)
| Group | Check | Owner |
|---|---|---|
| Inventory | 1. All LLM applications, including unsanctioned use by teams, are listed | Security lead |
| Inventory | 2. Each application has a named business owner | Product owner |
| Inventory | 3. Model providers and their terms on training and retention are recorded | Legal / procurement |
| Access | 4. The model acts with the requesting user's rights, not a shared account | Engineering lead |
| Access | 5. Each tool has the narrowest scope it needs | Engineering lead |
| Access | 6. High-risk actions require human approval | Product owner |
| Data | 7. Retrieval is filtered by user rights before content reaches the model | Data owner |
| Data | 8. Personal and confidential data is minimized or redacted in prompts | Data owner |
| Data | 9. Retention periods are set for logs and chat history | Compliance lead |
| Testing | 10. Prompt injection tests, including indirect injection, have passed | Security lead |
| Testing | 11. Outputs are validated before reaching other systems | Engineering lead |
| Testing | 12. An evaluation set of real questions has passed the agreed threshold | Product owner |
| Monitoring | 13. Prompts, sources, and tool calls are logged and traceable | Engineering lead |
| Monitoring | 14. Usage and cost limits are set, with alerts | Engineering lead |
| Monitoring | 15. An incident response plan covers LLM-specific events | Security lead |
LLM security options: how to choose
Most "best tools" lists are published by vendors and rank their own product first. A more useful approach is to start from the gaps found in the checklist and pick a category for each.
Table 5. Security tool categories
| Category | What it covers | When you need it |
|---|---|---|
| AI gateway and guardrail filters | Input and output filtering, topic limits, rate limits | Several applications use external models |
| AI security posture management | Inventory of models, data, and permissions | AI use is spread across teams |
| Data loss prevention | Detection of sensitive data in prompts and outputs | Users handle regulated or confidential data |
| Red-teaming and testing tools | Automated injection and jailbreak tests | Before each major release |
| Observability and logging | Traces of prompts, sources, tool calls, and cost | Any application in production |
Six criteria help compare products within a category: coverage of the four stages, data location, integration with your stack, audit logs, false-positive handling, and the pricing model. On build versus buy, inventory, logging, and filtering are usually bought, while access rules and approval flows are built into the application itself, because they depend on your business logic.
How CodeGeeks Solutions builds LLM-based solutions securely
CodeGeeks Solutions works as an AI-native product engineering partner: it helps companies automate operations, modernize legacy systems, and build AI-enabled products on secure, dependable data foundations. In AI chatbot development, this means retrieval from approved sources, "must-not-do" rules, safe fallbacks, human handoff, and access controls with Okta or Azure AD, with data sources that stay client-owned and an NDA on request.
Two published projects show the approach. In the Inspection Management Platform, access is scoped by role for field technicians, admins, and clients. In the Lead and Data Intelligence System, Claude models parse queries and clean data across more than 184 million records.
Plan a secure LLM rollout
If your team is moving an assistant or agent from pilot to production, the next decision is which workflows to automate and under what rules. CodeGeeks Solutions designs AI automation for business workflows with clear rules and guardrails from day one. Book a free 30-minute call to map your first workflow and its security requirements.
FAQ
What is LLM security?
LLM security is the practice of protecting applications built on large language models from misuse, data leaks, and unsafe actions. It covers the full path of a request: the input the model receives, the model and its supply chain, the data it retrieves, and the output or action it produces.
It differs from traditional security because the input is natural language. The model cannot reliably separate instructions from data, so a document or email can carry hidden commands. Many LLM applications can also call tools and APIs, which turns a wrong answer into a wrong action.
In practice, it combines familiar controls, such as access management, encryption, and logging, with new ones: prompt injection testing, output validation, retrieval filtering by user rights, and human approval for high-risk actions. The OWASP Top 10 for LLM Applications 2025 is the common reference for the risks, and NIST AI RMF is the usual frame for governance in the US.
What are the biggest LLM security risks?
The biggest risks are prompt injection, sensitive information disclosure, and excessive agency. These three appear at the top of most incident reviews because they are easy to trigger and hard to filter.
Prompt injection happens when text inside an input, such as a web page or an email, changes the model's behavior. Sensitive information disclosure happens when the model reveals data the user should not see, often because retrieval ignores user rights. Excessive agency happens when the model has more tools or permissions than the task needs.
Other risks in the OWASP list include supply chain issues with models and plugins, data and model poisoning, improper output handling, system prompt leakage, weaknesses in vector stores, misinformation, and unbounded consumption.
The practical answer is to rank them by your architecture. A read-only assistant on public documents carries far less risk than an agent with write access to customer records, so the controls and testing effort should follow that difference.
How do you protect data used with an LLM?
Protect data at each point it passes through: prompts, retrieval sources, fine-tuning sets, logs, and outputs. The core rule is to give the model only the data the current user is allowed to see, and only as much as the task needs.
For prompts, redact identifiers and credentials before sending text to an external model. For retrieval, apply access filters before documents reach the model, and keep separate indexes for separate tenants. For fine-tuning, use only approved and cleaned data with a recorded origin.
Logs and chat history are often the largest store of sensitive data, so set retention periods and restrict who can read them. Outputs need filters for known sensitive patterns.
Finally, read the model provider's terms. Record whether prompts are used for training, how long they are retained, and where they are processed. These answers often decide which provider and deployment option a regulated team can use.
What are the LLM security best practices for enterprises?
The core practices are least-privilege access, untrusted handling of inputs and outputs, a secured supply chain, guardrails, logging, and regular red-team testing. For enterprises, each of these also needs an owner and evidence.
Start with an inventory of every LLM application, including tools teams adopted without approval. Then assign a business owner to each one and set a review before launch. Engineering applies the technical controls, security runs injection tests, and data owners approve which sources the model may use.
Human approval is the most effective control for high-risk actions, such as payments, record deletion, or messages sent to customers. Approval can be relaxed later once logs show the system behaves reliably.
Enterprises should also plan for scale. A central team can maintain shared components, such as the AI gateway, logging, and evaluation sets, while product teams own their use cases. This keeps one approval path without slowing every team down.
Which compliance rules and standards apply to LLM security?
There is no single law for LLM security compliance. Most organizations combine general privacy and security obligations with AI-specific frameworks, so the answer depends on industry, data type, and market.
In the US, NIST AI RMF 1.0 is the most common backbone for an AI risk program, and NIST AI 600-1 adds actions specific to generative AI. ISO/IEC 42001:2023 defines a certifiable AI management system and is useful when customers ask for formal assurance. Companies selling AI systems in the EU should track the EU AI Act, whose obligations apply in phases.
Sector rules still apply. Healthcare data falls under HIPAA, payment data under PCI DSS, and personal data of EU residents under GDPR, whether or not an LLM processes it.
Standards were checked on 26 Nov 2026. This answer is informational, not legal advice, so confirm the obligations that apply to your specific product, data, and markets with legal counsel.
How is LLM security different from traditional application security?
Traditional application security assumes structured input and predictable code paths. LLM security deals with free text and probabilistic behavior, so the same input can produce different outputs.
In a traditional web application, input validation can define what is allowed. With an LLM, any text can act as an instruction, including text the user never typed, such as a retrieved document. This is why prompt injection has no complete fix today and must be contained through limited access.
Outputs also differ. A traditional function returns predictable data, while a model can produce code, links, or commands. Those outputs must be validated like untrusted user input before another system uses them.
Testing changes as well. Unit tests check fixed behavior, while LLM applications need evaluation sets of real questions, red-team exercises, and monitoring after launch. Familiar practices, such as access control, encryption, and logging, still apply and often matter more than model-level filters.
What should you look for in the best LLM security options?
Look for coverage of your actual gaps, not for the highest-ranked product on a vendor list. Start from your checklist results, then choose a category: gateway and guardrails, posture management, data loss prevention, red-team testing, or observability.
Within a category, compare six criteria. Coverage shows which of the four stages the product protects. Data location matters for regulated data and for where prompts are processed. Integration shows whether it works with your models, identity provider, and logging stack. Audit logs decide whether the product produces evidence your compliance team can use.
False-positive handling is often underestimated. A filter that blocks too many legitimate requests will be switched off by users or developers. The pricing model, per request, per user, or per application, changes the total cost as usage grows.
Ask for a trial on your own traffic. A short test with real prompts from your users reveals more than any feature table.






