Back to Blog
AI Security

OWASP Top 10 for LLMs: How to Test the Security of Generative AI Applications

Applications built on top of language models have a different attack surface from traditional web applications. Understand the OWASP Top 10 for LLMs and how a pentest for this kind of application works in practice.

Lucca Lo Presti
7/29/2026
13 min read
AI SecurityLLM SecurityOWASPPrompt InjectionPentestApplication Security
OWASP Top 10 for LLMs: How to Test the Security of Generative AI Applications
DIRECT ANSWER

What is the OWASP Top 10 for LLMs?

It is a list maintained by OWASP of the ten most critical security risks in applications built on Large Language Models (LLMs), including Prompt Injection, sensitive data leakage, excessive permissions granted to the model, and vulnerabilities in the supply chain of models and plugins.

Applications built on Large Language Models (LLMs) — chatbots, internal assistants, AI-augmented search systems (RAG) — introduce an attack surface that differs from what security teams are used to testing in traditional web applications.

OWASP maintains a dedicated project documenting the most critical risks in this type of application. Understanding those risks is the first step before testing the security of any solution based on generative AI.

Why LLM Applications Need a Different Approach

Traditional security testing focuses on vulnerabilities such as SQL Injection, XSS, and authentication flaws — all related to how code processes structured input.

LLMs process unstructured natural language as instructions, which creates a fundamentally different class of risk: under certain conditions, the user's own input can be interpreted by the model as a command — even when the developer intended it to be treated purely as content.


Key Risks in the OWASP Top 10 for LLMs

1. Prompt Injection

The best-known and most widely discussed risk. An attacker manipulates the input given to the model to bypass system instructions, extract restricted information, or induce the model to perform unauthorized actions.

There are two main variants: direct, when the user inserts the malicious prompt themselves, and indirect, when the malicious instruction is embedded in external content the model processes — such as a document, email, or web page the LLM is asked to summarize or analyze.

2. Sensitive Data Leakage

Models connected to knowledge bases, internal documents, or corporate APIs can expose information the user should not have permission to access — especially when access control is not enforced consistently between the system that owns the data and the AI layer.

3. Model Supply Chain

Risks related to the components used to build the solution: third-party models, plugins, frameworks, and training data — each introducing an additional trust surface that needs to be evaluated.

4. Training Data Poisoning

When a model is fine-tuned with attacker-controlled data, it is possible to introduce biases, backdoors, or unwanted behaviors that only surface under specific conditions.

5. Improper Handling of Model Output

When the model's response is consumed directly by other systems without validation — for example, executed as code or inserted straight into a web page — traditional vulnerabilities such as XSS or remote code execution can be reintroduced through the LLM's output.

6. Excessive Permissions (Excessive Agency)

Models connected to tools and APIs that can perform actions (send emails, modify records, execute transactions) need strictly limited permissions. A manipulated model with broad permissions can cause real damage, not just expose information.

7. System Prompt Leakage

System instructions often contain business logic, internal rules, or information the company does not intend to make public. Prompt extraction techniques aim to expose those instructions.

8. Overreliance on Model Responses

Models can generate incorrect answers in a convincing way (hallucinations). When those answers feed automated decisions without human validation, the business impact can be significant.


How a Pentest for AI Applications Works

A pentest for LLM-based applications combines traditional application security techniques with tests specific to the model:

  • Structured attempts at direct and indirect Prompt Injection
  • Tests for extracting the system prompt and training data
  • Assessment of access control in knowledge base (RAG) integrations
  • Analysis of the permissions granted to the model in integrations with APIs and external tools
  • Security testing of the APIs and the infrastructure hosting the application
  • Assessment of how model outputs are handled before feeding other systems

Conclusion

Generative AI applications do not replace the need for traditional application security — they add an entirely new layer of risk on top of it.

Companies launching chatbots, internal assistants, or any LLM-based solution connected to corporate data and systems need to treat this assessment as part of the process — not as an optional step to be done after the product is already in production.

Has Your AI Application Been Tested Against Prompt Injection?

LoPrestiSec performs security assessments of LLM-based applications, including Prompt Injection, access control, and integration testing.

  • Web Application Pentest
  • API Pentest
  • Security Code Review
  • Threat Modeling

Get in touch to assess the security of your AI application.

❓ Frequently Asked Questions

Get answers to the most common questions

There is no definitive, complete solution, given that the very nature of LLMs is to process instructions in natural language. But the risk can be significantly reduced through input validation, limiting the model's permissions, and an architecture that separates system instructions from user-supplied content.
It depends on what it can access. A chatbot with no access to sensitive data or internal systems carries lower risk. But most real-world implementations connect the model to knowledge bases, documents, or internal APIs — and that is where the risk increases significantly.
Through structured attempts to manipulate the system instructions, extract the original prompt, bypass content restrictions, and induce the model to perform unauthorized actions using the permissions and integrations available to it.
Yes. RAG systems retrieve information from external knowledge bases to enrich the model's responses — if access control over that knowledge base is not properly enforced, the model may expose information the user should not be allowed to see.

Still have questions? Reach out to us through the contact form or via WhatsApp.

Last updated: 7/29/2026
Author: Lucca Lo Presti - Offensive Security Specialist

Need Professional Security Help?

LoPrestiSec delivers end-to-end penetration testing, security consulting and LGPD compliance services. More than 200 companies trust our work.

Get in Touch →