Securing AI and LLM Systems with the OWASP Top 10 for LLM in Enterprise Deployments
A technical engineering guide to defending enterprise LLM applications against prompt injection, sensitive data leakage, excessive tool agency, unsafe Markdown output, and supply-chain risks.
Enforce strict trust boundaries between system instructions and retrieved RAG context to mitigate direct and indirect prompt injection.
Apply least privilege to tool calling by separating read and write actions and requiring explicit human confirmation for state-changing operations.
Sanitize LLM Markdown and HTML output before rendering, while pinning model weights, plugins, and network egress under NIST AI RMF governance.
When enterprises move large language models (LLMs) from isolated prototypes into production environments connected to internal knowledge bases (RAG) and business APIs, the attack surface expands well beyond conventional web applications. Hidden text inside an uploaded PDF, customer email, or CRM note can steer a model past its intended policy, trigger unauthorized tool invocations, or inject executable payloads into an operator's browser.
The OWASP Top 10 for LLM Applications and the NIST AI Risk Management Framework (AI RMF) provide a structured baseline for defense-in-depth engineering. Instead of relying solely on prompt keyword filters, production AI systems must enforce strict boundaries across retrieved data, tool execution privileges, output rendering, and software supply chains.
Prompt Injection and Sensitive Information Disclosure in RAG
Prompt injection occurs when untrusted input alters a model's instruction flow. In direct injection, a user submits text designed to override system rules. In indirect injection, malicious directives sit inside crawled web pages, support tickets, or shared files indexed for retrieval. Once the retriever pulls that passage into the context window, the model cannot reliably separate governance rules from raw text awaiting summarization.
Company blog
Read next
This threat often overlaps with Sensitive Information Disclosure. Placing API keys, pricing rules, or moderation logic inside a system prompt leaves them vulnerable to extraction attacks. Even more common in enterprise RAG deployments is a shared vector index lacking document-level access control lists (ACLs), allowing an employee in one department to retrieve contracts, HR records, or personally identifiable information (PII) from another.
Backend teams should enforce four concrete controls:
Keep secrets, connection strings, and authorization rules out of system prompts; enforce all access decisions in deterministic server-side code.
Apply identity-aware filtering (RBAC or ABAC) inside the vector database query before any chunk enters the LLM context window.
Wrap untrusted external content in explicit delimiters, tag source provenance, and disable sensitive tool access while processing unverified text.
Run Data Loss Prevention (DLP) inspection on both inputs and outputs to detect and redact PII, access tokens, or internal keys before client delivery.
Controlling Excessive Agency and Insecure Output Handling
Granting an LLM function calling or access to tool servers such as MCP introduces Excessive Agency whenever the service holds broader permissions than required. An order-lookup assistant should never use a credential capable of deleting records, issuing refunds, or emailing external domains. Otherwise, a single indirect prompt injection inside a customer reply can chain multiple tool calls into unauthorized data modification or exfiltration.
Alongside tool permissions, Insecure Output Handling creates serious client and server risks. Many AI web interfaces render model-generated Markdown directly into HTML. Without strict sanitization, an attacker can coerce the model into emitting javascript: links, external image tags that leak conversation history via query parameters, or cross-site scripting (XSS) payloads running inside an operator's active session.
In production designs, teams should separate read-only lookup tools from state-changing actions. Operations such as infrastructure changes, refunds, or bulk notifications should produce a structured draft and pause for explicit confirmation backed by a valid session token. On the frontend, Markdown renderers must strip raw HTML, allow only https: or mailto: links, and pair with a tight Content Security Policy (CSP).
Organizations planning internal AI integrations can review our IT architecture and security consulting services to audit permission boundaries and adversarial testing workflows before scaling.
Supply-Chain Hygiene and Governance Under NIST AI RMF
An LLM system's risk starts before inference inside its model and software supply chain. Loading open-weight checkpoints serialized with unsafe formats such as Python pickle can trigger arbitrary code execution during startup. Similarly, unaudited plugins or third-party connectors can expose environment variables and cloud credentials.
Teams should pin model artifacts and packages with SHA-256 digests, prefer safe serialization formats such as safetensors, run plugins inside isolated sandboxes with strict outbound egress allowlists, and emit structured audit logs for every tool call and retrieved document ID.
Pairing these controls with the four NIST AI RMF functions (Govern, Map, Measure, and Manage) turns AI security into a continuous engineering cycle rather than a one-time pre-launch review.
Scope, Caveats, and Practical Limitations
This article synthesizes engineering practices mapped to the public OWASP Top 10 for LLM Applications and NIST AI Risk Management Framework alongside ToanKhonTech's software architecture practice. It does not report newly discovered vulnerabilities in any specific model provider or cloud platform.
Actual exposure depends on each organization's data classification, connected tool permissions, and runtime infrastructure. Controls such as context isolation, output sanitization, and tool scoping require continuous adversarial testing and complement rather than replace foundational identity, encryption, and network security layers.
References
Sources used to check this article. Any ToanKhonTech test results are identified separately in the text.